Setting Named Anchors


To set an anchor on your page, simply drop an anchor tag in the exact location you want the browser to go. Remember to specify the name attribute instead of the href attribute so that the tag functions as a destination instead of a source.

One of the most common uses of this technique is to divide a long Web page into several sections. You see this often on FAQ pages. The top of the page contains the frequently asked questions (FAQs), which are href anchors. The answers to the questions follow, each with its own named anchor tag, like so:

 <a name="question01"></a> <p><strong>What is the meaning of life?</strong></p> <p>The meaning of life is money.</p> <a name="question02"></a> <p><strong>What is the meaning of money?</strong></p> <p>The meaning of money is time.</p> <a name="question03"></a> <p><strong>What is the meaning of time?</strong></p> <p>The meaning of time is life.</p> 

As Figure 66.1 shows, the named anchors themselves don't appear in the browser window. They're not visible elements. They simply provide a specific location to which you can link.

Figure 66.1. Named anchors don't appear in the browser window, but the browser definitely knows they're there. Link to one of the anchors, and the browser jumps to its precise location.




Web Design Garage
Web Design Garage
ISBN: 0131481991
EAN: 2147483647
Year: 2006
Pages: 202
Authors: Marc Campbell

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net