alt (HTML attribute)
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
| IE | 5.5 | None |
|---|---|---|
| 6.0 | None | |
| 7.0 | None | |
| Firefox | 1.0 | None |
| 1.5 | None | |
| 2.0 | None | |
| Safari | 1.3 | None |
| 2.0 | None | |
| 3.0 | None | |
| Opera | 9.2 | None |
| 9.5 | Full |
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.

