HTML <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>
嘗試一下»
瀏覽器支持
所有主流瀏覽器都支持<area> 標籤。
標籤定義及使用說明
<area> 標籤定義圖像映射內部的區域(圖像映射指的是帶有可點擊區域的圖像)。
<area> 元素始終嵌套在<map> 標籤內部。
註釋: <img>標籤中的usemap屬性與<map>元素中的name相關聯,以創建圖像與映射之間的關係。
HTML 4.01 與HTML5之間的差異
HTML5 提供了一些新屬性,同時不再支持HTML 4.01 中的某些屬性。
HTML 與XHTML 之間的差異
在HTML 中,<area> 標籤沒有結束標籤。
在XHTML 中,<area> 標籤必須正確地關閉。
屬性
New :HTML5中的新屬性。
属性 | 值 | 描述 |
---|---|---|
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。 |
全局屬性
<area>標籤支持HTML的全局屬性 。
事件屬性
<area>標籤支持HTML的事件屬性 。
相關文章
HTML DOM參考手冊: Area對象