You are here: Reference > HTML > attributes > name (a)

name attribute (a)

Browser support:
Sets the name of a target anchor.
Named anchors can be the targets of source anchors. If the href attribute of an anchor is set to the '#targetName' value, where the targetName is the value of an anchor's name attribute, then the first anchor (source) refers to the second anchor (target anchor). Clicking on the source anchor scrolls the target anchor into the visible area of the document. See the page for the href attribute or Example 1 for further details.
JavaScript page for this attribute: name. You can find other example(s) there.

Possible values:

String that sets the name of the target anchor.
Default: this attribute has no default value.

Example HTML code 1:

This example illustrates the use of the name attribute:
Table of contents:
<ul>
    <li><a href="#section1">1. Section</a></li>
    <li><a href="#section2">2. Section</a></li>
    <li><a href="#section3">3. Section</a></li>
</ul>

<b><a name="section1">1. Section</a></b><br />
First line in the section.<br />...<br />...<br />...<br />
Last line in the section.<br /><br />

<b><a name="section2">2. Section</a></b><br />
First line in the section.<br />...<br />...<br />...<br />
Last line in the section.<br /><br />

<b><a name="section3">3. Section</a></b><br />
First line in the section.<br />...<br />...<br />...<br />
Last line in the section.<br /><br />
Did you find this example helpful? yes no

Supported by tags:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content