小兔网

html area标签是什么意思?关于html area标签的用法你知道多少?本篇文章就给大家介绍了html area标签的定义和使用案例,还有关于html area标签属性的介绍(附实例)

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="https://zhishitu.com/ke" alt="Venus" />  <area shape="circle" coords="129,161,10" href="https://zhishitu.com/ke" alt="Mercury" />  <area shape="rect" coords="0,0,110,260" href="https://zhishitu.com/ke" 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="https://zhishitu.com/ke">

HTML<area>标签实例:

<!doctype html><html><head><meta charset="UTF-8"><title>html< area>标签_PHP笔记</title></head><body><img src="http://www.zhishitu.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="https://zhishitu.com/ke" shape="rect" coords="85,0,280,50" alt="PHP笔记" href="https://zhishitu.com/ke" shape="rect" coords="85,50,275,70" alt="www.zhishitu.com" href="https://zhishitu.com/ke">

注释:<img> 中的 usemap 属性可引用 <map> 中的 id 或 name 属性(由浏览器决定),所以我们需要同时向 <map> 添加 id 和 name 两个属性。

HTML 与 XHTML 之间的差异

在 HTML 中,<area> 没有结束标签。

在 XHTML 中,<area> 必须正确地关闭。

【相关推荐】

html5 source type有什么用处?html5 source标签的详细介绍

script标签在HTML中的作用是什么?script标签中type属性的用法是什么?

以上就是html area标签是什么意思?html area标签的用法详解的知识。速戳>>知识兔学习精品课!