Adding Internal Links with the Named Anchor TagYou can link to a section within a page of either the current page, or another document. An anchor tag must be used first to define the named section you will link too. For example on most of my pages I have a named anchor at the top of my page defined as: <a name="top" id="top"></a>Note there isn't anything between the anchor tags, but there could be, it's up to you. Viewers of your page will not be able to see this anchor tag or bookmark, unless they view your source code. To link to a named section within your own page, use a relative link, with a # sign in front of the name in the anchor tag. In this example, I might have: Take me to the top. created with html code: <a href="#top">top</a> The following table summarizes these two variations of the anchor tag.
I often use this technique with Web pages that extend longer than one screen. I place a named anchor at the top of the document, then place a link to it at the bottom of the Web page. Extracts of the html code used to produce this current page, (Much of the middle has been deleted, replaced by etc..). The named anchor tags and hyperlink are in larger font size and bold to emphasis the code.
If this page is not loaded within another frame, you can click on this top hyperlink, and notice how the address changes in the browser address bar. Please NOTE, unlike most html code, bookmark names defined in anchor tags are case sensitive!! If the name is defined in all lower case letters, you must use all lower case letters in linking to that named anchor. This page was last updated on 01/23/2008 by L.M. Hicks |