HTML alt Attribute

HTML alt Attribute defines alternative text for the images which are not displayed for whatever reason. This alt attribute also helps the search engines and screen readers.

Syntax of HTML alt Attribute

The Syntax of HTML alt Attribute is shown below.

<img alt="car" />

Usage of HTML alt Attribute

HTML alt Attribute is used to define alternative information about the images which go missing due to any reason.

It is also used for the Search Engine Optimization by helping search engines understand the content.

Screen readers also use the information written inside alt attribute.

Used For

HTML alt Attribute is used for following tags.

Tag Name
HTML img Tag
HTML input Tag
HTML area Tag

Example of HTML alt Attribute

Simple example of HTML alt Attribute is given below.

<img src="car.png" alt="white car"/>

In above example we have used HTML alt Attribute to define the alternative text for the image being used.

Values of HTML alt Attribute

Value of HTML alt Attribute is simple information which defines the purpose of the image or image itself.

ValueDescription
Alt TextInformation about the image.

Browser Support for HTML alt Attribute

HTML alt Attribute is supported by following major browsers.

Browser NameVersion
ChromeAll
FirefoxAll
OperaAll
IE / EdgeAll
SafariAll