In the World Wide Web hyperlinks are of the highest importance. They link different sites around the World together, as well as different parts of the same site internally.

Many search engines analyze the links on a website and their number trying to understand its popularity (so called PageRank).

Links can be formed as:

  • links with absolute URI (i.e. "");
  • links with relative to the document URI (i.e. "../index.php#anchor_1");
  • links as anchors when they are defined in the same document or same page.

The key attribute used is the href attribute which defines the linking URI or points to the anchor and the name attribute which is used as an anchor.

The id attribute may also be used as an anchor but not if there already is an anchor defined with the name attribute.

To link to an anchor the href attribute needs # character attached to the anchor name (i.e. <a href="#anchor_1">go to the anchor</a>)

Nesting link tags under other link tags (i.e. <a href="#"><a href="#"></a></a>) is illegal.

Two other elements can be used to define links; <link> and <base> elements. They are used to explain document's relationship to other documents and to define the document's base link's path, respectively. For functional reasons they are placed inside the HTML Document Head section, rather than this one.


<a href="URI"></a>



HTML hyperlink element:


›› go to examples ››