20%的功能满足80%的需求。爱、喜悦、和平。
带有可点击区域的图像映射:
<html>
<body>
<p>请点击图像上的星球,把它们放大。</p>
<img
src="http://www.w3school.com.cn/i/eg_planets.jpg"
border="0" usemap="#planetmap"
alt="Planets" />
<map name="planetmap" id="planetmap">
<area
shape="circle"
coords="180,139,14"
href ="http://www.w3school.com.cn/example/html/venus.html"
target ="_blank"
alt="Venus" />
<area
shape="circle"
coords="129,161,10"
href ="http://www.w3school.com.cn/example/html/mercur.html"
target ="_blank"
alt="Mercury" />
<area
shape="rect"
coords="0,0,110,260"
href ="http://www.w3school.com.cn/example/html/sun.html"
target ="_blank"
alt="Sun" />
</map>
<p><b>注释:</b>img 元素中的 "usemap" 属性引用 map 元素中的 "id" 或 "name" 属性(根据浏览器),
所以我们同时向 map 元素添加了 "id" 和 "name" 属性。</p>
</body>
</html>
定义和用法
标签定义图像映射中的区域(注:图像映射指得是带有可点击区域的图像)。 area 元素总是嵌套在 标签中。 注释: 标签中的 usemap 属性与 map 元素 name 属性相关联,创建图像与映射之间的联系。
提示和注释:
注释: 中的 usemap 属性可引用 中的 id 或 name 属性(由浏览器决定),所以我们需要同时向 添加 id 和 name 两个属性。
必需的属性
属性 值 描述
alt text 定义此区域的替换文本。
可选的属性
属性 值 描述
coords 坐标值 定义可点击区域(对鼠标敏感的区域)的坐标。
href URL 定义此区域的目标 URL。
nohref nohref 从图像映射排除某个区域。
shape default 定义区域的形状。
rect
circ
poly
target _blank 规定在何处打开 href 属性指定的目标 URL。 _parent
self
_top