Skip to: content, navigation

by Ian Lloyd

alt (HTML attribute)

Spec
Depr. Version
No HTML 3.2
Browser support full matrix
IE7 FF2 Saf3 Op9.5+
None None None Full
alt="string"

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>

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.

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

IE5.5None
6.0None
7.0None
Firefox1.0None
1.5None
2.0None
Safari1.3None
2.0None
3.0None
Opera9.2None
9.5Full

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 9.5.

User-contributed notes

There are no comments yet.

Add a note

To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

Related Products

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters