HTML <area> altAttribute

HTML area 标签HTML <area> Tag

Example

An image map with clickable areas:

<img src="planets.gif.html" width="145" height="126" alt="Planets"
usemap="#planetmap">

<map name="planetmap">
<area shape="rect" coords="0,0,82,126" href="sun.htm.html" alt="Sun">
<area shape="circle" coords="90,58,3" href="mercur.htm.html" alt="Mercury">
<area shape="circle" coords="124,58,8" href="venus.htm.html" alt="Venus">
</map>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the alt attribute.


Definition and Usage

The alt attribute is a required attribute that specifies alternative text when the image cannot be displayed.

If users cannot view the image for the following reasons, the alt attribute can provide alternative information for the image:

  • Slow internet speed
  • Error in the src attribute
  • The browser has images disabled
  • The user uses a screen reader

The alt attribute is required if the href attribute is used.


Differences between HTML 4.01 and HTML5

In HTML 4.01, the alt attribute is required.

In HTML5, the alt attribute is required only when the href attribute is used. If the href attribute is not used, the alt attribute is not needed either.


Syntax

<area alt="text">

Attribute Values

Value Description
text Specifies alternative text for the area when the image cannot be displayed.


HTML area 标签HTML <area> Tag

Other Extensions