htmlarea标签的定义和用法:
<area>标签定义图像映射中的区域(注:图像映射指得是带有可点击区域的图像)。
area元素总是嵌套在<map>标签中。
注释:<img>标签中的usemap属性与map元素name属性相关联,创建图像与映射之间的联系。
HTML<area>标签实例:
带有可点击区域的图像映射:
<imgsrc="planets.jpg"border="0"usemap="#planetmap"alt="Planets"/>
<mapname="planetmap"id="planetmap">
<areashape="circle"coords="180,139,14"href="venus.html"alt="Venus"/>
<areashape="circle"coords="129,161,10"href="mercur.html"alt="Mercury"/>
<areashape="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中的新属性。
格式:
<areashape="形状"coords="坐标"href="目标URL">
HTML<area>标签实例:
<!doctypehtml>
<html>
<head>
<metacharset="UTF-8">
<title>html<area>标签_PHP笔记</title>
</head>
<body>
<imgsrc="http://www.php.cn/themes/Nana2.09/images/logo.png"alt="html<area>标签"width="300px"height="70px"alt="PHP笔记logo"usemap="#logo">
<mapname="logo">
<areashape="rect"coords="0,0,70,70"alt="图标"href="#">
<areashape="rect"coords="85,0,280,50"alt="PHP笔记"href="#">
<areashape="rect"coords="85,50,275,70"alt="www.php.cn"href="#">
</map>
<h3>上面图片被分为3个区域</h3>
</body>
</body>
</html>
注释:<img>中的usemap属性可引用<map>中的id或name属性(由浏览器决定),所以我们需要同时向<map>添加id和name两个属性。
HTML与XHTML之间的差异
在HTML中,<area>没有结束标签。
在XHTML中,<area>必须正确地关闭。


本文转载自中文网
本文转载自中文网
如需转载,请注明文章出处和来源网址:http://www.divcss5.com/html5/h54836.shtml