alt (HTML attribute)

Spec
Depr. Version
No HTML 3.2
Browser support (more…)
IE8 FF3.5 SA4 OP9.5+ CH2
None None None Full None

Syntax

alt="string"

Description

In the event that the user can’t view the image—perhaps because he or she is accessing your page over a very slow connection, because an incorrect src attribute has been defined, or because the user is visually impaired and is accessing the content using a screen reader—the alt attribute provides alternative content that can be displayed instead of the image.

Thus, an alt attribute applied to the area element will render over that area if the image isn’t displayed.

Example

This alt attribute explains the link destination—a Wikipedia entry:

<map name="bigthings" id="bigthings">
  <area shape="rect" coords="35,4,205,108"
      href="http://en.wikipedia.org/wiki/Australia's_Big_Things"
      alt="Australia's Big Things (on Wikipedia)"/>
  ⋮
</map>
<p><img src="giant-prawn.jpg" alt="The Giant Prawn at Ballina"
border="0" usemap="#bigthings"/></p>

Value

This attribute takes as its value text that’s equivalent to the purpose or destination of the link (as defined by the href attribute). For a full rundown of how best to handle content inside the alt attribute, refer to the alt element type.

Compatibility

Internet Explorer Firefox Safari Opera Chrome
5.5 6.0 7.0 8.0 1.0 1.5 2.0 3.0 3.5 1.3 2.0 3.1 4.0 9.2 9.5 10.0 2.0
None None None None None None None None None None None None None None Full Full None

Unlike the img’s alt attribute, support for the alt attribute’s application to the area element is poor. In cases where the image was unavailable, only the img’s alt attribute was displayed by the tested browsers. The alternative text for the clickable areas defined by the area elements’ alt attributes wasn’t rendered by any browser except Opera versions 9.5 and 10.

User-contributed notes

There are no comments yet.

Related Products