The <a href> Tag in HTML 5

The <a href> tag is used to define a hypertext link. It is one of the tags for interactive content in HTML. If a user clicks on the link, the referenced document will be loaded by the browser or other web client. Only the <a href> version of the anchor tag is described here since the <a name> version is no longer used (see Changes in HTML 5 below)

<a rel="nofollow" href="index.pdf">...</a>

A series of inline hypertext links can be used to create a breadcrumb trail:

This is an actual working demo of the <a href> example code below.

HTML Anchors
Defining the target of a link within a page

The href attribute of the <a> tag can reference the id attribute of one of the HTML tags to link to a specific point within a web page, automatically scrolling the browser window if necessary to make that section of the web page appear in the currently visible area. To specify the target location, include a hash symbol ("#") followed by the id of the target location in the href attribute of the <a> tag. The URLs of bookmarks or favorites can also point to specific locations in a web page.

The tags that are involved in creating the document outline, which include the <section> tag, <hgroup> tag and heading tag would be some examples of good places for HTML anchors:

<section id="main-section-a">
   <h1>Section A</h1>
   ...
   <hgroup id="implied-section-b">
      <h2>Section B</h2>
      <h3>...</h3>
   </hgroup>
   ...
   <h2 id="implied-section-c">Section C</h2>
   ...
</section>
<a name/> and <a id/> anchor tags

The <a/> tag was originally used to define a fixed point (hence the name anchor and element type name a) in a document for the target of a hypertext link. However, starting with HTML version 4 (1997), any HTML element can be used as an anchor simply by including an id attribute on the element start tag or the standalone tag of a void element. From http://www.w3.org/TR/html401/struct/links.html#h-12.2.3:

The id attribute may be used to create an anchor at the start tag of any element (including the A element).

Note that as a result of how the HTML specifications have evolved, the <a> tag should not be used as an anchor, and in order to avoid confusion, probably should not be called the anchor tag.

<link> tag for links to related documents

In addition to the <a> tag for hypertext links, the HTML <link> tag can be used to reference other things, such as profiles of the web page author(s), related to the current HTML web page.