Easy Tutorial
❮ Att Input Formnovalidate Tag Span ❯

HTML <img> alt Attribute

HTML <img> Tag

Example

An image with specified alternative text:


Browser Support

All major browsers support the alt attribute.


Definition and Usage

The alt attribute is a required attribute that specifies an alternate text for an image, if the image cannot be displayed.

Should the image fail to load due to slow internet connection, errors in the src attribute, images being disabled in the browser, or the user employing a screen reader, the alt attribute provides alternative information.

Note: Internet Explorer versions prior to 9 display the value of the alt attribute as a tooltip when the mouse is hovered over the img element. This behavior is not compliant with HTML specifications.

Tip: To create a tooltip for an image, use the title attribute!


Differences Between HTML 4.01 and HTML5

None.


Syntax

Attribute Values

Value Description
text Specifies the alternate text for the image. Principles for using alt text: If the image conveys information, use alt to describe the image. <br> If the image is within an <a> element, use alt to describe the target link. <br> If the image is purely decorative, use alt="".

❮ Att Input Formnovalidate Tag Span ❯