Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Attribute for <A ...>
NAME = "text string"

NAME gives the anchor a name. Other links target the anchor using that name. This allows you to link to specific places within the page.

For example, suppose you have a long page with a section about purchasing. You could create a named anchors in the sub-header for that section like this:

<H2><A NAME="purchasing">Purchasing</A></H2>

Note that the <A ...> tag goes inside the <H2 ...> tags. Unlike an anchor that uses HREF, a named anchor doesn't change the appearance of the text (unless you set styles for that anchor) or indicate in any way that there is anything special about the text. The purpose of the name is that another anchor can link to the named anchor.

To link to a named anchor, add a hash mark to the end of the URL of the page followed by the name. For example, to link to a section named purchasing within the page called anameexample.html we would create a link like this:

<A HREF="anameexample.html#purchasing">Purchasing</A>

which gives us this link:


If the link is to a named anchor in the same page then you don't need the file name of the page, just the hash mark and the name of the anchor. For example, you could put a set of links at the top of a long page that link to sections within the page. To link to the purchasing section in our example above you would put a link like this:

this code produces this
<A HREF="#purchasing">Purchasing</A>
the links at the top of this page

Don't forget the hash mark. That's the most common mistake made in this type of linking and has been a source of frustration for many webmasters. Remember these two rules:

The named anchor itself doesn't have a hash mark.
<A NAME="purchasing">
A link to the named anchor always has a hash mark.
<A HREF="#purchasing">

  Copyright 1997-2002 Idocs inc. Published under the terms of the Open Content License Design by Interspire