Skip to main content

Hypertext Links Within the Same Document

Imagine a book. You turn to the contents page and what to go to "Chapter 7". Having found the starting page of the required chapter you then can turn to that page. The contents page contains the link information whilst the chapter is anchored on a particular page of the book. Having obtained the link information you can go to the anchor point.

HTML allows for a similar task to be performed within an HTML document. This is the beginnings of the true power of HTML the ability of one document to cross-reference itself and, more importantly, information in other documents using hypertext links. When referencing a point within an HTML document (either the same document or another one) when the link is called (or click on) the browser positions the reader at the anchor point.

Any text that has a link associated with it is shown, by your browser, in a different colour.

Text that has an anchor associated with it must be marked in the following way:

<a href="anchor type text">
This must be typed at the beginning of the link text. Note: there is a space after the a. The "anchor type text" takes different forms depending upon whether the link's reference is within the current document; referencing another document on the same system or a resource on another system anywhere in the world!
</a>
Is typed after the link text.

To reference an anchor point within the same document the link description takes the following form:

<a href="#ref1">This is a reference to the bottom of this document</a>

Note: the # character before the name of the anchor, "ref1" in this case. The anchor's name is specified by you.

The above would appear highlighted in the following way when viewed by your browser:

This is a reference to the bottom of this document

Within the HTML document the following text must appear at the anchor point:

<a name="ref1">text</a>

To follow the link, click on any part of the highlighted text. Use your browser's Back button to return to this calling point.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Hello, here we are at the bottom of this Web page. You can use the Browser's Back button to return to the original text or, of course, we could use another anchor point. Click on the following text to return to the text. Return to the text