html area標(biāo)簽的定義和用法:
area 標(biāo)簽定義圖像映射中的區(qū)域(注:圖像映射指得是帶有可點(diǎn)擊區(qū)域的圖像)。
area 元素總是嵌套在 map 標(biāo)簽中。
注釋: img 標(biāo)簽中的 usemap 屬性與 map 元素 name 屬性相關(guān)聯(lián),創(chuàng)建圖像與映射之間的聯(lián)系。
HTML area 標(biāo)簽實(shí)例:
帶有可點(diǎn)擊區(qū)域的圖像映射:
img src= planets.jpg border= 0 usemap= #planetmap alt= Planets / map name= planetmap id= planetmap area shape= circle coords= 180,139,14 href = venus.html alt= Venus / area shape= circle coords= 129,161,10 href = mercur.html alt= Mercury / area shape= rect coords= 0,0,110,260 href = sun.html alt= Sun / /map
area 標(biāo)簽屬性:
alt:區(qū)域的替代文本。
coords:區(qū)域的坐標(biāo)。
href:區(qū)域的目標(biāo)url。
hreflang:目標(biāo)url的語(yǔ)言,html5中的新屬性。
media:目標(biāo)url是為何種媒介/設(shè)備優(yōu)化的,html5中的新屬性。
nohref:沒有相關(guān)鏈接的區(qū)域,html5不支持。
rel:當(dāng)前文檔與目標(biāo)url之間的關(guān)系,html5中的新屬性。
shape:區(qū)域的形狀。
target:在何處打開目標(biāo)url。
type:目標(biāo)url的 MIME 類型,html5中的新屬性。
格式:
area shape= 形狀 coords= 坐標(biāo) href= 目標(biāo)URL
HTML area 標(biāo)簽實(shí)例:
!doctype html html head meta charset= UTF-8 title html area 標(biāo)簽_PHP筆記 /title /head body img src= http://www.survivalescaperooms.com/themes/Nana2.09/images/logo.png alt= html area 標(biāo)簽 width= 300px height= 70px alt= PHP筆記logo usemap= #logo map name= logo area shape= rect coords= 0,0,70,70 alt= 圖標(biāo) href= # area shape= rect coords= 85,0,280,50 alt= PHP筆記 href= # area shape= rect coords= 85,50,275,70 alt= www.survivalescaperooms.com href= # /map h3 上面圖片被分為3個(gè)區(qū)域 /h3 /body /body /html
注釋: img 中的 usemap 屬性可引用 map 中的 id 或 name 屬性(由瀏覽器決定),所以我們需要同時(shí)向 map 添加 id 和 name 兩個(gè)屬性。
HTML 與 XHTML 之間的差異
在 HTML 中, area 沒有結(jié)束標(biāo)簽。
在 XHTML 中, area 必須正確地關(guān)閉。
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。
新聞熱點(diǎn)
疑難解答
圖片精選