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> ...

Get Web Design Garage now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.