html <area> 标签
实例
带有可点击区域的图像映射:
<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,0,110,260" href ="sun.html" alt="sun" /> </map>
亲自试一试
浏览器支持
所有主流浏览器都支持 <area> 标签。
定义和用法
<area> 标签定义图像映射中的区域(注:图像映射指得是带有可点击区域的图像)。
area 元素总是嵌套在 <map> 标签中。
注释:<img> 标签中的 usemap 属性与 map 元素 name 属性相关联,创建图像与映射之间的联系。
html 与 xhtml 之间的差异
在 html 中,<area> 没有结束标签。
在 xhtml 中,<area> 必须正确地关闭。
提示和注释:
注释:<img> 中的 usemap 属性可引用 <map> 中的 id 或 name 属性(由浏览器决定),所以我们需要同时向 <map> 添加 id 和 name 两个属性。
必需的属性
| alt | text | 定义此区域的替换文本。 |
可选的属性
| coords | 坐标值 | 定义可点击区域(对鼠标敏感的区域)的坐标。 |
| href | url | 定义此区域的目标 url。 |
| nohref | nohref | 从图像映射排除某个区域。 |
| shape |
|
定义区域的形状。 |
| target |
|
规定在何处打开 href 属性指定的目标 url。 |
全局属性
<area> 标签支持 html 中的全局属性。
事件属性
<area> 标签支持 html 中的事件属性。
tiy
创建图像映射 本例显示如何创建带有可供点击区域的图像映射。其中的每个区域都是一个超级链接。【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!