HTML area alt attribute
Examples
With clickable image map area:
<img src="planets.gif"
width="145" height="126"
alt="Planets"
usemap="#planetmap">
<map name="planetmap">
<area shape="rect" coords="0,0,82,126" href="sun.htm" alt="Sun">
<area shape="circle" coords="90,58,3" href="mercur.htm" alt="Mercury">
<area shape="circle" coords="124,58,8" href="venus.htm" alt="Venus">
</map>
usemap="#planetmap">
<map name="planetmap">
<area shape="rect" coords="0,0,82,126" href="sun.htm" alt="Sun">
<area shape="circle" coords="90,58,3" href="mercur.htm" alt="Mercury">
<area shape="circle" coords="124,58,8" href="venus.htm" alt="Venus">
</map>
try it"
Browser Support
All major browsers support the alt attribute.
Definition and Usage
alt attribute is a required attribute that specifies alternate text when the image can not be displayed.
Suppose the following reasons users can not view the image, alt attribute provides alternative information to the image:
- Speed is too slow
- src attribute error
- Disable the Image Browser
- The user is using a screen reader
If you use the href attribute alt attribute is required.
Differences between HTML 4.01 and HTML5
Alt attribute in HTML 4.01 is a must.
In HTML5, it only uses the href attribute alt attribute is required. If no href attribute, alt attribute is not needed.
grammar
<area alt="text">
Property Value
值 | 描述 |
---|---|
text | 在图片无法显示的情况下指定区域的替代文本。 |