Ford & Mason Ltd
HOME
ABOUT
CONTACT
RESOURCES
ADVERTISING



donations support the development of
cronolog.org
and
refcards.com

next up previous contents index
Next: Including Images in Up: The Hypertext Markup Previous: Block formatting elements


Hypertext links

A hypertext link is a pointer from a place in a document to another destination. At its simplest this destination is a different document. The destination might be a resource other than a document, such as an external image, a video clip or a sound file, or a labelled point in the original document, or a labelled point in a different document. Hypertext links are what puts the hyper into hypertext!

Hypertext links referring to non-HTML resources usually cause an external program, a viewer or helper application, to be invoked by the browser to display or play the resource. Setting up browsers, including the use of external viewer programs, is discussed in Section gif.

Both the starting point and the destination of a hypertext link are referred to as anchors and are marked by the anchor tag <A>. Anchors may have several attributes, but they must have one or both of the NAME and the HREF attributes.

    <A NAME="name" HREF="dest-url">highlighted text</A>

The HREF attribute specifies that the anchor is the start of a hypertext link and the attribute value (dest-url) is the destination URL. The browser highlights the text between the <A> and </A> tags and interprets clicks on the text as a request for the document referenced. The text should follow on immediately after the <A> tag and the </A> end tag should immediately follow the text, with no embedded spaces, otherwise space characters will be highlighted, which looks silly.

The NAME attribute specifies that the anchor is the destination of a link which has been set up elsewhere.

The remaining attributes, METHODS, REL, REV and URN, also optional, are not commonly used or supported by browsers. Their syntax is described in the HTML specification but their functionality is still being discussed by the Web development community.

Here are some examples of how different types of hypertext links can be set up.

  <A HREF="http://www.somesite.org/doc.html">description</A>

This code could be used to create a hypertext link from one location in a document to another document. http://www.somesite.org/document.html is the URL of the destination document, and description will appear as highlighted text in the original document.

Lines referencing a non-document resource such as an image, audio or video clip are set up in a similar way:

  <A HREF="http://www.somesite.org/image.gif">an image</A>
  <A HREF="http://www.somesite.org/audio.au">a sound</A>
  <A HREF="http://www.somesite.org/video.mov">a movie</A>

The browser makes no interpretation of the URL, merely sending a request to the named server, which will determine the type of resource, generally from the filename extension, and send the resource together with an indication of its type to the browser. The browser will attempt to start an external application to display any resource that it cannot handle itself.

Hypertext links can be created from one location in a document to another location in the same document:

    <A HREF="#next_topic">jump to the next topic</A>

The destination must have a named anchor:

    <A NAME="next_topic">text</A>

You can also make a link to a named anchor in a separate document:

  <A HREF="http://www.somesite.org/doc.html#next_topic">jump
  to the next topic</A>

When the anchor is selected a browser may use the optional TITLE attribute to display the title of the document being fetched. Of course, the title specified in the anchor may be different from that in the document being fetched.

  <A HREF="http://www.somesite.org/document.html" 
     TITLE="An English Country Garden">an English garden</A>


next up previous contents index
Next: Including Images in Up: The Hypertext Markup Previous: Block formatting elements

[ITCP]Spinning the Web by Andrew Ford
© 1995 International Thomson Publishing
© 2002 Andrew Ford and Ford & Mason Ltd
Note: this HTML document was generated in December 1994 directly from the LaTeX source files using LaTeX2HTML. It was formatted into our standard page layout using the Template Toolkit. The document is mainly of historical interest as obviously many of the sites mentioned have long since disappeared.

 
Copyright © 1996-2002 Ford & Mason Ltd