Anchors in HTML (23 views)

Anchors, what are they? And even more interesting, how do you make them? In this tutorial you will learn the ins and outs of HTML page content jumpers.


Many people don't know what anchor are, and how they work. In this tutorial I will show you through examples how they work.

What is an anchor?
An anchor consists out of two things, a point and a link. An anchor point is a place in your content where you want to link to. People also call it "page content jumpers", because it jumps to another part of the page.

Take the following page:
My school page.

You'll see a list of subjects, and answers beneath it. The links are anchor links, and it sends you to the anchor point. This is a working example of an anchor.

How do you make anchors?

It's actually quite simple, take a look at the following example:

php
1
2
3
4
5

<a href="#anchor">Anchorlink</a>
 
<!-- Some content bla bla -->
 
<a name="anchor">Anchorpoint</a>
 


The first line (Anchorlink) is the link to the anchor called "anchor". Note that you always add a "#" before the name, or else it won't work. I assume the rest of the tag speaks for itself.

The second line (Anchorpoint) is the point. Just add the name of the anchor in the name="..." attribute. So this is the place the link will send you to. Note that this time you don't add a "#" before the name.

One little anchor example:

Back to the top of this tutorial

Well that was easy right?



Replies on Anchors in HTML:
Jump to comment page: 1

 By crespo on Tuesday 12 February 2008 3:53

Can you do it in this way:
<p name="HTML">HTML</a>

<a href="#HTML">Back to html</a>




 By Jim on Thursday 14 February 2008 22:55

Thats a better usage indeed, keeps of the link hovers.



Jump to comment page: 1
You are not logged in. Please login or register an account, it just takes 30 seconds.


©Copyrights Combined Minds. All rights reserved 2006 - 2008 : Disclaimer
Realized by www.Minna-Media.com