HTML <area> 标签
示例
一个图像地图,带有可点击的区域
<img src="workplace.jpg" alt="Workplace" usemap="#workmap" width="400" height="379">
<map name="workmap">
<area shape="rect" coords="34,44,270,350" alt="Computer" href="computer.htm">
<area shape="rect" coords="290,172,333,250" alt="Phone" href="phone.htm">
<area shape="circle" coords="337,300,44" alt="Cup of coffee" href="coffee.htm">
</map>
自己动手试一试 »
更多“自己尝试”的例子见下文。
定义和用法
<area>
标签定义了图像映射(图像映射是带有可点击区域的图像)中的一个区域。
<area>
元素总是嵌套在 <map>
标签内。
注意:<img>
标签中的 usemap
属性与 <map>
元素的 name
属性相关联,并在图像和地图之间建立关系。
浏览器支持
元素 | |||||
---|---|---|---|---|---|
<area> | 是 | 是 | 是 | 是 | 是 |
属性
Attribute | 值 | 描述 |
---|---|---|
alt | text | 为区域指定替代文本。如果存在 href 属性,则此项是必需的 |
coords | coordinates | 指定区域的坐标 |
download | filename | 指定用户点击超链接时将下载目标 |
href | URL | 为区域指定超链接目标 |
hreflang | language_code | 指定目标 URL 的语言 |
media | 媒体查询 | 指定目标 URL 针对什么媒体/设备进行了优化 |
referrerpolicy | no-referrer no-referrer-when-downgrade origin origin-when-cross-origin same-origin strict-origin-when-cross-origin unsafe-url |
指定链接随同发送的引用者信息 |
rel | alternate author 书签 帮助 license next nofollow noreferrer prefetch prev search tag |
指定当前文档与目标 URL 之间的关系 |
shape | default rect circle poly |
指定区域的形状 |
target | _blank _parent _self _top framename |
指定目标 URL 的打开位置 |
type | media_type | 指定目标 URL 的媒体类型 |
全局属性
<area>
标签还支持 HTML 中的全局属性。
事件属性
<area>
标签还支持 HTML 中的事件属性。
更多示例
示例
另一个图像映射,带有可点击区域
<img src="planets.gif" width="145" height="126" alt="行星"
usemap="#planetmap">
<map name="planetmap">
<area shape="rect" coords="0,0,82,126" href="sun.htm" alt="Sun">
<area shape="circle" coords="90,58,3" href="mercur.htm" alt="Mercury">
<area shape="circle" coords="124,58,8" href="venus.htm" alt="Venus">
</map>
自己动手试一试 »
相关页面
HTML DOM 参考:Area 对象
默认 CSS 设置
大多数浏览器将显示具有以下默认值的 <area>
元素
area {
display: none;
}