Recall & Review
beginner
What does the
src attribute in an <img> tag specify?The
src attribute tells the browser the location (URL or path) of the image file to display.Click to reveal answer
beginner
Why is the
alt attribute important for images?The
alt attribute provides alternative text describing the image. It helps screen readers for visually impaired users and shows text if the image fails to load.Click to reveal answer
beginner
Write a simple
<img> tag with a source of "cat.jpg" and alt text "A cute cat".<img src="cat.jpg" alt="A cute cat">Click to reveal answer
beginner
What happens if an image's
src is incorrect or the image file is missing?The browser shows the
alt text instead of the image, helping users understand what was supposed to be there.Click to reveal answer
intermediate
Can the
alt attribute be empty? When would you do this?Yes,
alt="" means the image is decorative and screen readers will skip it. Use this for images that don’t add important info.Click to reveal answer
What does the
src attribute in an <img> tag do?✗ Incorrect
The
src attribute tells the browser where to find the image file to display.Why should you always include an
alt attribute in images?✗ Incorrect
The
alt attribute helps users who can’t see the image understand its content.What will a browser show if the image file in
src is missing?✗ Incorrect
If the image can’t load, the browser displays the
alt text to explain what was missing.How do you mark an image as decorative so screen readers ignore it?
✗ Incorrect
An empty
alt attribute tells screen readers to skip the image because it’s only decorative.Which of these is a correct
<img> tag?✗ Incorrect
The correct attributes are
src for the image file and alt for alternative text.Explain why the
alt attribute is important for web images.Think about users who cannot see images.
You got /3 concepts.
Describe how to write an
<img> tag with both source and alt text.Remember both attributes are needed for good practice.
You got /3 concepts.