Tuesday, July 19, 2011

The Anchor Tag and the Name Attribute

The name attribute is used to jump directly into a specific section on a page without scrolling.
Below is the syntax of a named anchor:

<a name="label">Text to be displayed</a>

The name “attribute” is used to create a named anchor. The name of the anchor can be any text you care to use.
The line below defines a named anchor:

<a name="lessons">Select a lesson</a>

Notice that a named anchor is not displayed in a special way.
To link directly to the "lessons" section, add a # sign and the name of the anchor to the end of a URL, like this:

<a href="http:// http://www.youtube.com //html_links.asp#resuits">
Jump to the results Section</a>

A hyperlink to the Useful Tips Section from WITHIN the file "html_links.asp" will look like this:

<a href="#lessons">Jump to the lessons Section</a>


No comments:

Post a Comment