必需的name属性指定图像映射的名称,name属性与 <img>的usemap属性相关联,并在图像和地图之间创建关系。
在线示例
具有可点击区域的图像地图:
<!DOCTYPE html>
<html>
<head>
<title>HTML:<map> name 属性 - 大卫编程网(div.cn)</title>
</head>
<body>
<p>Click on the sun or on one of the planets to watch it closer:</p>
<img src="planets.gif" width="145" height="126" alt="Planets" usemap="#planetmap">
<map name="planetmap">
<area shape="rect" coords="0,0,82,126" alt="Sun" href="/tags/sun.html">
<area shape="circle" coords="90,58,3" alt="Mercury" href="/tags/mercur.html">
<area shape="circle" coords="124,58,8" alt="Venus" href="/tags/venus.html">
</map>
</body>
</html>
测试看看 ‹/›浏览器兼容性
IEFirefoxOperaChromeSafari
所有主流浏览器都支持 name 属性。
定义和用法
name属性指定图像映射的名称。
name属性与<img>的usemap属性相关联,并在图像和地图之间创建关系。
HTML 4.01 与 HTML5之间的差异
没有。
语法
<map name="mapname">
属性值
值 | 描述 |
---|---|
mapname | 图像映射的名称。 |
展开全部