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. "http://www.brenkoweb.com/index.php");
- 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.
- id, class (document-wide identifiers)
- lang (language information), dir (text direction), charset (character encodings)
- title (element title)
- style (inline style information)
- shape, coords (image maps)
- target (target frame information)
- tabindex (tabbing navigation)
- accesskey (access keys)
- name (elements name, anchor name)
- type (content type)
- href, hreflang, rel, rev (links specific attributes)
- onfocus, onblur, onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup (intrinsic events)
HTML hyperlink element: