name attribute is used to create a named anchor.
When using named anchors we can create links that can jump directly into a specific section on a page, 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>The name of the anchor can be any text you care to use. The line below defines a named anchor:
<a name="demo">Demonstration</a>You should notice that a named anchor is not displayed in a special way. To link directly to the “demo” section, add a # sign and the name of the anchor to the end of a URL, like this:
<a href="http://undcemcs01.und.edu/~wen.chen.hu/course/101/
6/13.html#demo">Jump to the Demonstration</a>
A hyperlink to the Demonstration from within this file looks like this:
<a href="#demo">Jump to the Demonstration</a>
href="http://www.w3schools.com/html"you will generate two HTTP requests to the server, because the server will add a slash to the address and create a new request like this:
href="http://www.w3schools.com/html/"Named anchors are often used to create “table of contents” at the beginning of a large document. Each chapter within the document is given a named anchor, and links to each of these anchors are put at the top of the document.
|
Yoga pants are all the rage (very much in fashion) in North America right now, but in two years probably nobody will be wearing them. |