Sets an alternate text that is displayed when the file associated with the element cannot be displayed.

For example, when the src attribute of an image element refers to a file that is not available, the alternate text is displayed.

Note that in Internet Explorer, if the title attribute is not specified, the alternate text is also displayed as a tooltip regardless of whether the file associated with the element can be displayed.
In other browsers, the alt attribute does not specifies a tooltip only an alternate text.

If you want set a tooltip for an element, use the title attribute instead.

JavaScript page for this attribute: alt. You can find other example(s) there.

Possible values:

String that sets the alternate text.

Default: this attribute has no default value.

Example HTML code 1:

This example illustrates the use of the alt attribute:

See this image:
<divstyle="color:red"><imgsrc="notexisting.gif"alt="Sorry, the image is not available!"/></div>

Example HTML code 2:

This example illustrates the use of both the alt and title attributes:

<divstyle="color:red"><imgsrc="notexisting.gif"alt="Sorry, the image is not available!"title="This is my first image"/><br/><br/><imgsrc="picture.gif"alt="Sorry, the image is not available!"title="This is my last image"/></div><br/><br/>
Move the mouse pointer over the images to see the tooltips!