ALT attribute (or simply ‘alt’) is the HTML attribute used in HTML and XHTML to specify alt text (alternative text).
This alternative text is employed when the intended audience cannot interact with the element it is meant to represent. In SEO, alt text is often applied to images.
The ALT attribute (alternative text) is an HTML attribute used in the <img>
tag to specify alternative text for an image. This text serves multiple important purposes:
- Accessibility: Screen readers for visually impaired users read out the ALT text, allowing them to understand the content or function of the image.
- SEO (Search Engine Optimization): Search engines use the ALT text to understand the content of images, which can help in indexing and improving the page’s visibility in search results.
- Fallback Content: If an image fails to load (due to a broken link or other issue), the ALT text is displayed in its place.
Example of an image tag with an ALT attribute:
<img src="image.jpg" alt="A description of the image">
In this example, "A description of the image"
is the ALT text.