Anchor Tag & Name Attribute in HTML

Started by sajiv, Aug 18, 2008, 07:11 PM

Previous topic - Next topic

sajiv


The name attribute is used to create a named anchor. We can create links that can jump directly into a specific section on a page, using named anchors instead of letting the user scroll around to find what he/she is looking for.

Below is the syntax of a named anchor:
<a name="label">Text to be displayed</a>

To create a named anchor the name attribute is used. The name of the anchor can be any text you care to use.
The line below defines a named anchor:
<a name="main">Main Section</a>

You should notice that a named anchor is not displayed in a special way.
To link directly to the a section, add a # sign and the name of the anchor to the end of a URL, like this:
<a href ="#main">Jump to the Main Section</a>

A hyperlink to the Main Section from within the file "html_links.asp" will look like this:
<a href="#main">Jump to the Main Section </a>

:acumen