ToC ~ Up ~ Prev ~ Next ~ Index Introduction to HTML
Last Update: 5 January 1998

4.13 Hypertext Anchors

An anchor is a piece of text or some other object (for example an image) which marks the beginning and/or the end of a hypertext link. The <A> element is used to mark that piece of text (or inline image), and to give its hypertextual relationship to other documents. The text between the opening and closing tags, <A attributes> ...text... </A> can be the start or destination (or both) of a link. Here are some simple examples:

<A HREF="http://www.edu/st/file.html">bla bla</A>
The string `bla bla' is a hypertext link to the document `file.html' located at the indicated URL.
<A HREF="image.jpeg"> <IMG SRC="icon.gif"> </A>
The image `icon.gif' is a hypertext link to the image file located in the same directory as the currently accessed document (unless otherwise specified by the BASE element). This can allow you to use a small icon that links the user to a larger version of the same image. Alternatively the anchor tag could have been <A HREF="document.html">, in which case the image acts like an icon button than links the user to the indicated HTML document.
<A NAME="frxx">textbla</A>
The string `textbla' can be the target of a link. This link is referenced via the form "file.html#frxx" where 'file.html' is the file that contains this anchor and `#frxx' is the anchor NAME. If you are already in `file.html' the file is implicit, so it can be left out.

Attributes for A and LINK

The following sections describe the attributes appropriate to either Anchor or LINK elements. The entries marked '*' are commonly used and should be well understood. The other attributes are less common, and can be omitted at an introductory reading.

  1. HREF (link to object) *
  2. NAME (link from object) *
  3. REL (relationship between objects)
  4. REV (relationship between objects)
  5. URN (URN for the document -- this attribute has been dropped from the HTML specifcation, and should not be used)
  6. TITLE (TITLE of document)
  7. METHODS (how to link -- this attribute has been dropped from the HTML specifcation, and should not be used)

ToC ~ Up ~ Prev ~ Next ~ Index Introduction to HTML
© 1994-1998 by Ian Graham
Last Update: 5 January 1998