HTML Image Tag Attributes
Question
Which attribute is required on an <img> tag for accessibility?
Hint
It provides alternative text for screen readers.
Explanation
The alt attribute provides alternative text for images, essential for accessibility. Screen readers read it to visually impaired users, and browsers show it if the image fails to load. For decorative images, use alt="" (empty) to indicate they should be skipped. The src attribute is also required for the image source URL.
Related Resources
Related Lessons
- HTML
Learn HTML structure and tags.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.