home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

Book HomeWeb Design in a NutshellSearch this book

11.3. Linking Within a Document

By default, when you link to a page, the browser displays the top of that page. To aid in navigation, you can use the anchor tag to link to a specific point or section within a document. This navigation technique is only effective on long documents. Linking to specific destinations in a document is a two-step process in which you place a marker in the document and give it a name, and then you make a link to that marker.

11.3.3. Linking to a fragment in another document

You can create a link to a named fragment of any document on the Web by using the complete pathname. (Of course, the named anchors would have to be in place already.) To link to the stocks section from another document in the same directory, use a relative pathname as follows:

<A HREF="dailynews.html#stocks">Go to today's Stock Quotes</A>

Use an absolute URL to link to a fragment on another site, as in the following example:

<A HREF="http://www.website.com/document.html#fragment">

11.3.4. Using named anchors

Named anchors are most often used as a navigational aid by creating a hyperlinked table of contents at the top of a very long scrolling web page. Users can see the major topics at a glance and quickly get to the portions that interest them. When linking down into a long page, it is generally a good idea to add links back to the top of the page or to the table of contents.

Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.