HTML 5 <area> 標(biāo)簽
定義和用法
<area> 標(biāo)簽定義圖像映射中的區(qū)域。
HTML 4.01 與 HTML 5 之間的差異
HTML 5 有一些新的屬性,且不再支持 HTML 4.01 的一些屬性。
例子:
<img src ="planets.gif" alt="Planets" usemap ="#planetmap" /> <map id ="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>
屬性
屬性 | 描述 | 4 | 5 |
---|---|---|---|
alt |
定義此區(qū)域的替換文本。如果 href 存在,則該屬性是必需的。 僅在 href 屬性存在時使用。 |
4 | 5 |
coords | 定義可點(diǎn)擊區(qū)域的坐標(biāo)。 | 4 | 5 |
href | 定義此區(qū)域的目標(biāo) URL。 | 4 | 5 |
hreflang | 規(guī)定目標(biāo) URL 的基準(zhǔn)語言。僅在 href 屬性存在時使用。 | 4 | 5 |
nohref | 不贊成。從圖像映射排除一個區(qū)域。 | 4 | |
media | 規(guī)定目標(biāo) URL 的媒介類型。默認(rèn)值:all。僅在 href 屬性存在時使用。 | 5 | |
ping |
由空格分隔的 URL 列表,當(dāng)用戶點(diǎn)擊該鏈接時,這些 URL 會獲得通知。 僅在 href 屬性存在時使用。 |
5 | |
rel | 規(guī)定當(dāng)前文檔與目標(biāo) URL 之間的關(guān)系。僅在 href 屬性存在時使用。 | 5 | |
shape | 規(guī)定區(qū)域的形狀。 | 4 | 5 |
target | 在何處打開目標(biāo) URL。 | 4 | 5 |
type | 規(guī)定目標(biāo) URL 的 MIME 類型。僅在 href 屬性存在時使用。 | 5 |
標(biāo)準(zhǔn)屬性
class, contenteditable, contextmenu, dir, draggable, id, irrelevant, lang, ref, registrationmark, tabindex, template, title
如需完整的描述,請?jiān)L HTML 5 中標(biāo)準(zhǔn)屬性。
事件屬性
onabort, onbeforeunload, onblur, onchange, onclick, oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onerror, onfocus, onkeydown, onkeypress, onkeyup, onload, onmessage, onmousedown, onmousemove, onmouseover, onmouseout, onmouseup, onmousewheel, onresize, onscroll, onselect, onsubmit, onunload
如需完整的描述,請?jiān)L HTML 5 中事件屬性。
TIY
- 創(chuàng)建圖像映射
- 本例顯示如何創(chuàng)建帶有可供點(diǎn)擊區(qū)域的圖像映射。其中的每個區(qū)域都是一個超級鏈接。