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;
}