HTML <area> tag
Examples
With clickable image map area:
<img src="planets.gif"
width="145" height="126"
alt="Planets"
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>
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>
try it"
Browser Support
All major browsers support <area> tag.
Tag definitions and instructions
<Area> tag defines an area inside an image map (image map refers to an image with clickable areas).
<Area> element is always nested within <map> tag inside.
NOTE: <IMG> tag usemap attribute <map> element name is associated, to create the relationship between image and map.
Differences between HTML 4.01 and HTML5
HTML5 provides some new attributes, and some HTML 4.01 attributes are no longer supported.
Differences between HTML and XHTML
In HTML, <area> tag has no end tag.
In XHTML, <area> tag must be closed properly.
Attributes
New: HTML5 new property.
属性 | 值 | 描述 |
---|---|---|
alt | text | 规定区域的替代文本。如果使用 href 属性,则该属性是必需的。 |
coords | coordinates | 规定区域的坐标。 |
href | URL | 规定区域的目标 URL。 |
hreflang New | language_code | 规定目标 URL 的语言。 |
media New | media query | 规定目标 URL 是为何种媒介/设备优化的。默认:all。 |
nohref | value | HTML5 不支持。 规定没有相关链接的区域。 |
rel New | alternate author bookmark help license next nofollow noreferrer prefetch prev search tag |
规定当前文档与目标 URL 之间的关系。 |
shape |
default rect circle poly |
规定区域的形状。 |
target | _blank _parent _self _top framename |
规定在何处打开目标 URL。 |
type New | MIME_type | 规定目标 URL 的 MIME 类型。 注:MIME = Multipurpose Internet Mail Extensions。 |
Global Properties
<area> tag supports HTML global properties .
Event Properties
<area> tag supports HTML event properties .
related articles
HTML DOM Reference Manual: Area Objects