0
0
HTMLmarkup~20 mins

Alt text for images in HTML - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Alt Text Accessibility Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why is alt text important for images?
Which of the following best explains why adding alt text to images is important in web development?
AIt adds a border around the image to make it stand out visually.
BIt changes the image size automatically based on device screen width.
CIt helps search engines understand the image content and improves accessibility for screen readers.
DIt allows images to load faster by compressing them.
Attempts:
2 left
💡 Hint
Think about users who cannot see images and how they might understand the content.
📝 Syntax
intermediate
2:00remaining
Identify the correct alt attribute syntax
Which option shows the correct way to add alt text to an image in HTML?
HTML
<img src="flower.jpg" ____ >
A"moolb ni rewolf der A"=tla
Balt='A red flower in bloom'
Calt=A red flower in bloom
Dalt="A red flower in bloom"
Attempts:
2 left
💡 Hint
Alt text must be inside quotes and properly formatted.
rendering
advanced
2:00remaining
What is the visible output when alt text is used?
If an image fails to load in a browser, what will the user see if the image tag has alt text?
HTML
<img src="missing.jpg" alt="A mountain landscape">
AA broken image icon with no text will appear.
BThe text 'A mountain landscape' will be shown in place of the image.
CNothing will appear; the image area will be blank.
DThe browser will automatically load a default image.
Attempts:
2 left
💡 Hint
Alt text is a fallback description when images cannot load.
selector
advanced
2:00remaining
Which CSS selector targets images missing alt text?
You want to style images that do NOT have an alt attribute or have an empty alt attribute. Which CSS selector will select those images?
Aimg:not([alt]), img[alt=""]
Bimg[alt="*"]
Cimg[alt]
Dimg:empty
Attempts:
2 left
💡 Hint
Think about selecting elements missing an attribute or with an empty attribute value.
accessibility
expert
3:00remaining
Best practice for decorative images with alt text
For purely decorative images that add no meaningful content, what is the best practice for the alt attribute to ensure accessibility?
AUse alt="" (empty alt attribute) so screen readers skip the image.
BUse alt="decorative image" to describe the image purpose.
COmit the alt attribute entirely to hide the image from screen readers.
DUse alt="image" as a generic description.
Attempts:
2 left
💡 Hint
Think about how screen readers treat empty alt attributes.