Skip navigation


Linking Within a Single Page

Jump to the top, middle, or any other place

Okay, lets say you have one page that is pretty long. Maybe you would like to give someone a way back to the top of the page when they are at the bottom. Or maybe you want to divide it into sections and use a table of contents at the top. Well, the way to do this is to use a named anchor, which is a specific area of your page you want to make a link to. You could link to any part of the page, but for now, let's say you want to create a link to the top of your page. To do this, go to the top of the body section (right after the body tag). Now type the following tag:

<a name="top"></a>

You can place any name you wish inside the quotes. This just makes it easy to see where we are going to end up. Now, go anywhere between the body tags and type this link:

<a href="#top">Back to the Top</a>

If you click on this link, you will be sent back to the top of the page. You can try one I made on this page by clicking on the link below:

Back to top

The # sign is there to let the browser know the destination is a named anchor within this page. So, if you create an anchor named "cool", you link to that anchor by using "#cool", like this:

<a name="cool"></a>    <!--The anchor name-->
<a href="#cool">To the Cool Section of this page</a>
<!--Linking to the named section-->

You can place a named anchor anyplace on your page. You can link to it from any other part of the page. You can place one at the third paragraph, the bottom, the top, the 500th word. It can make navigating some pages a whole lot easier.

So, let's move on to the next section, The Email Link.

 



Topics: HTML & CSS | JavaScript | CGI & Perl | ASP/PHP | DHTML | Java | Contact Us | Privacy Policy

Copyright © 1997-2010 The Web Design Resource. All rights reserved. Disclaimer.