Linking to Elsewhere on the Same Pages.

Question: Hello. I have just started building a site of my own at Geocities.
I would like know as to how I can direct a link on a page to content on the same page.

Answer: To create a link to elsewhere on the same page, you need to first create an anchor point at the spot on the page that you want the link to jump to. The HTML code for the anchor point will look something like this:

<div id="here"></div>

How you create this in your choice of web editor depends on which editor you are using. I create my pages in notepad so I just type the codes in where I want them. Note also that the id can be on any tag within the body of the page, it doesn't have to be a div.

The other thing that you need to do is to create the link itself. The code will look something like this:

 <a href="#here">link to here</a> 

where the # indicates that the link is to an anchor point on the same page. In the above example, I named the anchor point "here" (you will see two references in the anchor and one in the link). You can call it whatever you want and if you want multiple positions to link to on the same page just give each one a different name.


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow