HTML <map> 標籤
示例
一個影像地圖,帶有可點選的區域
<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>
自己動手試一試 »
更多“自己嘗試”的例子見下文。
定義和用法
<map>
標籤用於定義一個影像對映。影像對映是指帶有可點選區域的影像。
<map>
元素的必需屬性 name 與 <img> 的 usemap 屬性關聯,並在影像和對映之間建立關係。
<map>
元素包含多個 <area> 元素,這些元素定義了影像對映中的可點選區域。
瀏覽器支援
元素 | |||||
---|---|---|---|---|---|
<map> | 是 | 是 | 是 | 是 | 是 |
屬性
Attribute | 值 | 描述 |
---|---|---|
name | mapname | 必需。指定影像對映的名稱 |
全域性屬性
<map>
標籤也支援 HTML 中的全域性屬性。
事件屬性
<map>
標籤也支援 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 參考:Map 物件
預設 CSS 設定
大多數瀏覽器將以以下預設值顯示 <map>
元素
map {
display: inline;
}