使用 alt 属性为图像映射中的每个区域指定替代文本:
<img src="../assets/workplace.jpg" alt="Workplace" usemap="#workmap" width="400" height="379"> <map name="workmap"> <area shape="rect" coords="34,44,270,350" alt="Computer" href="a.html"> <area shape="rect" coords="290,172,333,250" alt="Phone" href="abbr.html"> <area shape="circle" coords="337,300,44" alt="Cup of coffee" href="address.html"> </map>
如果图像无法显示,alt 属性指定区域的替代文本。
如果用户由于某种原因无法查看图像(由于连接速度慢、src 属性中的错误或用户使用屏幕阅读器),alt 属性会为图像提供替代信息。
如果存在 href 属性,则需要 alt 属性。
| 属性 |
|
|
|
|
|
|---|---|---|---|---|---|
| alt | Yes | Yes | Yes | Yes | Yes |
<area alt="text">
| 值 Value | 描述 Description |
|---|---|
| text | 如果图像无法显示,则指定该区域的替代文本 |