HTMLalt 属性
<area> 元素的 alt 属性用于设置区域的备用文本。当图像由于网络、加载问题、错误等原因无法显示时,会显示该备用文本,即 alt。
下面是语法 −
<area alt="text">
此处,文本是要设置的 alt 文本。
我们现在来看一个示例,以实现 <area> 元素的 alt 属性 −
示例
<!DOCTYPE html> <html> <body> <h2>Learning</h2> <p>Learn these technologies with ease....</p> <img src = /images/usemap.gif alt = "usemap" border = "0" usemap = "#tutorials"/> <map name = "tutorials"> <area shape = "poly" coords = "74,0,113,29,98,72,52,72,38,27" href = "/perl/index.htm" alt = "Perl Tutorial" target = "_blank" /> <area shape = "rect" coords = "22,83,126,125" alt = "HTML Tutorial" href = "/html/index.htm" target = "_blank" /> <area shape = "circle" coords = "73,168,32" alt = "PHP Tutorial" href = "/php/index.htm" target = "_blank" /> </map> </body> </html>
输出

在上面的示例中,我们已经在以下图像上设置了地图 −
<img src = /images/usemap.gif alt = "usemap" border = "0" usemap = "#tutorials"/>
现在,我们已经为该图像中的形状设置了地图和区域 −
<map name = "tutorials"> <area shape = "poly" coords = "74,0,113,29,98,72,52,72,38,27" href = "/perl/index.htm" alt = "Perl Tutorial" target = "_blank" /> <area shape = "rect" coords = "22,83,126,125" alt = "HTML Tutorial" href = "/html/index.htm" target = "_blank" /> <area shape = "circle" coords = "73,168,32" alt = "PHP Tutorial" href = "/php/index.htm" target = "_blank" /> </map>
在设置区域时,还使用 alt 属性设置了 alt −
<area shape = "poly" coords = "74,0,113,29,98,72,52,72,38,27" href = "/perl/index.htm" alt = "Perl Tutorial" target = "_blank" />
广告
数据结构
网络
关系数据库管理系统
操作系统
Java
iOS
HTML
CSS
安卓
Python
C 语言编程
C++
C#
MongoDB
MySQL
Javascript
PHP