CSS Portal

HTML alt Attribute

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
alt
HTML AttributeThis attribute is supported by all modern browsers.
Updated 25th March 2024

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

Applies To

Example

<img src="images/broken.jpg" alt="Image of Sunset">
<p>Note: The image will not load so that you can see the alt attribute in action.</p>
Open in editor

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

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee