html area标签的定义和用法:
area 标签定义图像映射中的区域(注:图像映射指得是带有可点击区域的图像)。
area 元素总是嵌套在 map 标签中。
注释: img 标签中的 usemap 属性与 map 元素 name 属性相关联,创建图像与映射之间的联系。
HTML area 标签实例:
带有可点击区域的图像映射:
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 标签属性:
alt:区域的替代文本。
coords:区域的坐标。
href:区域的目标url。
hreflang:目标url的语言,html5中的新属性。
media:目标url是为何种媒介/设备优化的,html5中的新属性。
nohref:没有相关链接的区域,html5不支持。
rel:当前文档与目标url之间的关系,html5中的新属性。
shape:区域的形状。
target:在何处打开目标url。
type:目标url的 MIME 类型,html5中的新属性。
格式:
area shape= 形状 coords= 坐标 href= 目标URL
HTML area 标签实例:
!doctype html html head meta charset= UTF-8 title html area 标签_PHP笔记 /title /head body img src= http://www.VeVb.com/themes/Nana2.09/images/logo.png alt= html area 标签 width= 300px height= 70px alt= PHP笔记logo usemap= #logo map name= logo area shape= rect coords= 0,0,70,70 alt= 图标 href= # area shape= rect coords= 85,0,280,50 alt= PHP笔记 href= # area shape= rect coords= 85,50,275,70 alt= www.VeVb.com href= # /map h3 上面图片被分为3个区域 /h3 /body /body /html
注释: img 中的 usemap 属性可引用 map 中的 id 或 name 属性(由浏览器决定),所以我们需要同时向 map 添加 id 和 name 两个属性。
HTML 与 XHTML 之间的差异
在 HTML 中, area 没有结束标签。
在 XHTML 中, area 必须正确地关闭。
郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。
新闻热点
疑难解答