English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML 参考手册

HTML 标签大全

HTML: <area> href 属性

href属性指定该区域的超链接目标,如果href属性不存在,则 <area>标签不是超链接,在 HTML5 In HTML, the <area> tag no longer uses the href attribute; use placeholder to specify the link.

 HTML <area> Tag

在线示例

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

<!DOCTYPE html>
<html>
<title>HTML:<area> href 属性 - 基础教程网 oldtoolbag.com</title>
<body>
<p>单击太阳或其中一个行星以近距离观察它</p>
<img src="planets.gif" width="145"height="126"alt="Planets" usemap="#planetmap">
  <map name="planetmap">
  <area shape="rect" coords="0,0,82,126"href="sun.html" alt="Sun">
  <area shape="circle" coords="90,58,3"href="mercur.html" alt="Mercury">
  <area shape="circle" coords="124,58,8"href="venus.html" alt="Venus">
  </map>  
</body>
</html>
Test it out ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the href attribute.

Definition and Usage

The href attribute specifies the target of the link within the area.

If the href attribute is not used, the <area> tag is not a link.

HTML 4.01 and HTML5Differences between

In HTML5 In HTML, the <area> tag no longer uses the href attribute; use placeholder to specify the link.

Syntax

<area href="URL">

Attribute value

ValueDescription
URL

The URL of the link. Possible values:

  • Absolute URL - Point to another site (e.g. href="http://www.example.com/sun.htm")

  • Relative URL - Point to a file within the site (href="sun.htm")

  • Anchor URL - Point to an anchor in the page (href="#sun")

 HTML <area> Tag