Latest web development tutorials

HTML <a> href attribute

HTML a Tag Reference HTML <a> tag

Examples

href attribute specifies the destination address of the link:

<p>绝对路径 URL: <a href="http://www.w3big.com/">本教程</a></p>
<p>相对路径 URL: <a href="tag_a.php">a 标签</a></p>

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the href attribute.


Definition and Usage

href attribute href tag used to specify the destination for the hyperlink URL.

If the href attribute is not specified links, <a> tag will not be a link.


The difference between HTML 4.01 and HTML5

In HTML5, if the label does not <a> href attribute, it will be a hyperlink placeholder.


grammar

<a href="URL">

Property Value

描述
URL 超链接的 URL。可能的值:
  • 绝对 URL - 指向另一个站点(比如 href="http://www.example.com/index.htm")
  • 相对 URL - 指向站点内的某个文件(href="index.htm")
  • 锚 URL - 指向页面中的锚(href="#top")


Examples

More examples

Use anchor URL
How to use the id to use anchor URL (HTML5 does not support name attribute).


HTML a Tag Reference HTML <a> tag