Syntax of anchor names
ARTICLE # 644
ADDED ON 19th Nov,2008
URL http://www.myitemstore.com/article/b1xku5uc6i.htm

An anchor name is the value of either the name or id attribute when used in the context of anchors. Anchor names must observe the following rules:

  • Uniqueness: Anchor names must be unique within a document. Anchor names that differ only in case may not appear in the same document.
  • String matching: Comparisons between fragment identifiers and anchor names must be done by exact (case-sensitive) match.

Thus, the following example is correct with respect to string matching and must be considered a match by user agents:

<P><A href="#xxx">...</A>
...more document...
<P><A name="xxx">...</A>

ILLEGAL EXAMPLE:
The following example is illegal with respect to uniqueness since the two names are the same except for case:

<P><A name="xxx">...</A>
<P><A name="XXX">...</A>

Although the following excerpt is legal HTML, the behavior of the user agent is not defined; some user agents may (incorrectly) consider this a match and others may not.

<P><A href="#xxx">...</A>
...more document...
<P><A name="XXX">...</A>

Anchor names should be restricted to ASCII characters. Please consult the appendix for more information about non-ASCII characters in URI attribute values.