Export to GitHub

doctype-mirror - AHrefAttribute.wiki


You are here: Home > HTML Reference > Elements > <a> element > href attribute

The href attribute on a hyperlink element must have a value that is a URI (or IRI). This URI is the destination resource of the hyperlink.

The href attribute on a and area elements is not required; when those elements do not have href attributes, they do not represent hyperlinks.

Usage

<a href="/">home</a>

Elements

You can use the href attribute on the following elements:

  • <a>
  • <area>
  • <link>

There is also an href attribute on the base element, but it means something else.

Browser compatibility

Compatibility table legend

| Test | IE8 | IE7 | IE6 | FF3 | FF2 | Saf3 | Op9 | Chrome | |:---------|:--------|:--------|:--------|:--------|:--------|:---------|:--------|:-----------| | a.href reflects <a href="http://www.example.com/"> | Y | Y | Y | Y | Y | Y | Y | Y |

Further reading