HTML <a> hrefAttributes
Examples
The href attribute specifies the target URL of the link:
<p>Absolute URL: <a href="../index.html">Example</a></p>
<p>Relative URL: <a href="tag_a.php.html">a tag</a></p>
<p>Relative URL: <a href="tag_a.php.html">a tag</a></p>
Try it Yourself »
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the href attribute.
Definition and Usage
The href attribute of the <a> tag is used to specify the URL of the hyperlink target.
If the href attribute is not specified, the <a> tag is not a link.
Difference Between HTML 4.01 and HTML5
In HTML5, if the <a> tag does not have an href attribute, it will be a placeholder hyperlink.
Syntax
<a href="URL.html">
Attribute Values
| Value | Description |
|---|---|
| URL | The URL of the hyperlink. Possible values:
|
More Examples
Using Anchor URL
How to use an anchor URL with id (the name attribute is not supported in HTML5).
Other Extensions
HTML <a> Tag