What is the alt attribute in HTML and why is it important?

The alt attribute of the <img> tag gives a short text description of the image.

<img src="bike.jpg" alt="Red bicycle near a wall">
  • It is shown when the image cannot load.
  • Screen readers read it, so blind visitors know what the image is.
  • Search engines use it to understand the image, so it helps SEO.

Write what the image shows, in a few words, and do not start with “image of”. For decorative images use an empty alt="". See HTML Images.


Learn more about the similar topics:
Tutorials
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.