Purpose:

An anchor tag will allow you to create a link that will jump directly to a specific part of your web page. It will allow a visitor to find information fast and go directly to what interests them.

This is what the anchor tag looks like.

<a name=“anchor1″>This is anchor one.</a>

The name of the anchor is “anchor1”. You can name it whatever you like but it should have something to do with the content that people will see when they go to that anchor. The code <a name=“anchor1″>is the opening tag, this is where the anchor starts. You can place text after this tag (like a heading) but you do not need to. You must close your tag with </a>.

The anchor tag itself does not do anything; all it is there for is to let the browser know where to go to. It is like a house address. To get to a house you need to know the address but if you want to get there you will have to drive there. If you actually want your visitors to get to the anchor you will need a link for them to click on. If you want to link to an anchor on the same page you can create it like this: <a href=”#anchor1”>Go to anchor one.</a>

Notice that this like looks the same as an anchor except it has an attribute that says ‘href’. This is telling the browser it needs to go somewhere. Also notice the # sign, this tells the browser that this is going to an anchor.

The visitor will see a link that says ‘Go to anchor one.’ and if the visitor clicks on this link it will take the visitor down to ‘anchor1’ which has the text that says ‘This is anchor one.’

If you are creating a like to an anchor on another page you need to include the URL. For example if ‘anchor1’ is on a page called my_anchors.html then your link will look like this: <a href=”my_anchors.html #anchor1”>Go to anchor one.</a>. This will take the visitor to directly to ‘anchor1’ on the page my_anchors.html.

Anchors are handy if you have long pages. It allows you to help your visitor find the information they want to see.

NOTE: if your page is too small it will not look like the link to the anchor is doing anything because you will see the whole page. To really see the effect an anchor has you need a page that scrolls and the anchor to be further down the page.