HTML area href 属性

HTML <area> href 属性

HTML area 标签参考手册 HTML <area> 标签

实例

带有可点击区域的图像映射:


  
    <img src="/planets.gif"
      width="145" height="126"
      alt="Planets"
usemap="#planetmap">

<map name="planetmap">
<area shape="rect" coords="0,0,82,126" href="https://zhishitu.com/" target="_blank" alt="Sun">
<area shape="circle" coords="90,58,3" href="https://zhishitu.com/" target="_blank" alt="Mercury">
<area shape="circle" coords="124,58,8" href="https://zhishitu.com/" target="_blank" alt="Venus">
</map>

知识兔 »

浏览器支持

所有主流浏览器都支持 href 属性。

定义和用法

href 属性规定区域中连接的目标。

如果没有使用href 属性,<area> 标签就不是一个链接。

HTML 4.01 与 HTML5之间的差异

在 HTML5 中, <area> 标签已经不再使用 href 属性, 使用 placeholder来指定链接。

语法

<area href="https://zhishitu.com/" target="_blank">

属性值

描述
URL

链接的 URL。可能的值:

  • 绝对 URL - 指向另一个站点(比如 href="https://zhishitu.com/" target="_blank">
  • 相对 URL - 指向站点内的某个文件(href="https://zhishitu.com/" target="_blank">
  • 锚 URL - 指向页面中的锚(href="https://zhishitu.com/" target="_blank">

HTML area 标签参考手册 HTML <area> 标签

计算机