Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML href property

HTML href property

HTML a Tag Reference HTML tag

Example

The href property specifies the target address of the link:

Absolute URL: Runoob Tutorial

Relative URL: a tag

Try it »


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the href property.


Definition and Usage

The href property of the tag is used to specify the URL of the hyperlink target.

If the href property is not specified for a link, the tag will not be a link.


Differences between HTML 4.01 and HTML5

In HTML5, if the tag has no href property, it will be a placeholder hyperlink.


Syntax

Attribute values

Value Description
URL The URL of the hyperlink. Possible values:
  • Absolute URL - points to another site (e.g., href="http://www.example.com/index.htm")
  • Relative URL - points to a file within the site (href="index.htm")
  • Anchor URL - points to an anchor on the page (href="#top")
  • |

    More examples

    Using anchor URLs
    How to use an anchor URL with id (the name property is not supported in HTML5).


    HTML a Tag Reference HTML tag