Challenge - 5 Problems
Image Tag Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate1:30remaining
What is the purpose of the alt attribute in an
tag?
Why should you always include the
alt attribute in an <img> tag?Attempts:
2 left
💡 Hint
Think about accessibility and what happens if the image cannot be displayed.
✗ Incorrect
The
alt attribute describes the image for people using screen readers and shows text if the image cannot load.📝 Syntax
intermediate1:30remaining
Which
tag is correctly written to display an image?
Choose the correct
<img> tag syntax that will display an image located at "images/photo.jpg" with alt text "A photo".Attempts:
2 left
💡 Hint
Remember the attribute that specifies the image file location is
src.✗ Incorrect
The
src attribute points to the image file. The alt attribute must have a value describing the image.❓ rendering
advanced2:00remaining
What will the browser display for this image tag?
Given this HTML code:
What will the browser show if the file "missing.jpg" does not exist?
<img src="missing.jpg" alt="Missing image">
What will the browser show if the file "missing.jpg" does not exist?
Attempts:
2 left
💡 Hint
Think about what the alt text is for when the image cannot load.
✗ Incorrect
If the image file is missing, the browser shows the alt text so users understand what was meant to be there.
❓ selector
advanced1:30remaining
Which CSS selector targets all images inside a element?
You want to style all
<img> tags that are inside any <section> element. Which CSS selector should you use?Attempts:
2 left
💡 Hint
Think about how to select elements nested inside another element.
✗ Incorrect
The selector
section img selects all img elements inside any section, at any depth.❓ accessibility
expert2:00remaining
Which practice improves accessibility for decorative images?
You have an image used only for decoration and it adds no information. How should you write the
<img> tag to improve accessibility?Attempts:
2 left
💡 Hint
Think about how screen readers treat empty alt attributes.
✗ Incorrect
An empty alt attribute tells screen readers to ignore the image, which is best for purely decorative images.