HTML alt Attribute
Description
The HTML alt attribute is used within an <img> tag to provide alternative text for an image. This text serves several important purposes: it describes the content of the image for users who are unable to see it, such as visually impaired users relying on screen readers, and it can be displayed in place of the image in browsers if the image file is not loaded. Additionally, the alt attribute enhances web accessibility, making the content of images available to users regardless of their ability to visually perceive them. It also plays a role in search engine optimization (SEO), as it provides search engines with context about the image content, which can help in indexing and ranking the website. Properly describing an image with the alt attribute involves succinctly conveying the image's content or function, making the web more inclusive and informative.
Syntax
<tagname alt="text">
Values
- textText to describe the alternative text
Example
Browser Support
The following information will show you the current browser support for the HTML alt attribute. Hover over a browser icon to see the version that first introduced support for this HTML attribute.
This attribute is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 25th March 2024
