| Depr. | Version |
|---|---|
| Yes | HTML 3.2 |
| IE5.5+ | FF1+ | SA1.3+ | OP9.2+ | CH2+ |
|---|---|---|---|---|
| Full | Full | Full | Full | Full |
Syntax
Description
The
name attribute is used to identify a link
destination, or anchor, on a page. It has been superseded by the
id attribute, but
it’s still used for the purposes of backwards compatibility (see the
section on the href attribute for
more).
Example
The following example
shows a link with the name attribute of
"mmm-cake":
<a href="cakes-ja.html" name="mmm-cake">lovely range
of Japanese cakes (note: this link will take you to
a page in Japanese language)</a>
Value
This attribute takes
a—preferably short—name of the author’s choosing. As this attribute will
often be paired with a matching id attribute, you
should observe the following rules regarding
ids.
The
id attribute value must begin with a letter in the
roman alphabet (a–z or A–Z); this can be followed by any combination of
letters (a–z or A–Z), digits (0–9), hyphens (-), underscores (_), colons
(:), and periods (.). The id value is case
sensitive, thus <span id="me">This is
me</span> and <span id="ME">This is
me</a> would be considered to be separate and uniquely
identifiable elements on the same web page.
Compatibility
| Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6.0 | 7.0 | 8.0 | 1.0 | 1.5 | 2.0 | 3.0 | 3.5 | 1.3 | 2.0 | 3.1 | 4.0 | 9.2 | 9.5 | 10.0 | 2.0 |
| Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full |
The use
of the name attribute for the purposes of linking
from one part of a page to another is well supported, but if your page is
written in XHTML, this attribute’s inclusion will cause your page to be
invalid.
User-contributed notes
Add a note
To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.