html <area> 标签定义图像映射内部的区域(图像映射指的是带有可点击区域的图像)
<area> 元素始终嵌套在 <map> 标签内部
<img> 标签中的 usemap 属性与 <map> 元素中的 name 相关联,以创建图像与映射之间的关系
提示和注释:
注释:<img> 中的 usemap 属性可引用 <map> 中的 id 或 name 属性(由浏览器决定),所以我们需要同时向 <map> 添加 id 和 name 两个属性。
必需的属性
属性 | 值 | 描述 |
---|---|---|
alt |
text | 定义此区域的替换文本。 |
可选的属性
属性 | 值 | 描述 |
---|---|---|
coords |
坐标值 | 定义可点击区域(对鼠标敏感的区域)的坐标。 |
href |
URL | 定义此区域的目标 URL。 |
nohref |
nohref | 从图像映射排除某个区域。 |
shape |
|
定义区域的形状。 |
target |
|
规定在何处打开 href |
实例
带有可点击区域的图像映射:
<img src="planets.jpg" border="0" usemap="#planetmap" alt="Planets" /> <map name="planetmap" id="planetmap"> <area shape="circle" coords="180,139,14" href ="venus.html" alt="Venus" /> <area shape="circle" coords="129,161,10" href ="mercur.html" alt="Mercury" /> <area shape="rect" coords="0,110,260" href ="sun.html" alt="Sun" /> </map>