HTML and CSS Reference
In-Depth Information
Figure 6-2. Internet Explorer puts a special border
around an image that is inside an anchor The name and id attributes
Use the name and id attributes with the <a> tag to create a fragment
identifier within a document. Once created, the fragment identifier be-
comes a potential target of a link.
Prior to HTML 4.0, the only way to create a fragment identifier was to
use the name attribute with the <a> tag. With the advent of the id at-
tribute in HTML 4.0, and its ability to be used with almost any tag, any
HTML or XHTML element can be a fragment identifier. The <a> tag re-
tains the name attribute for historic purposes and honors the id attribute
as well. These attributes can be used interchangeably, with id being the
more "modern" version of the name attribute. Both name and id can be
specified in conjunction with the href attribute, allowing a single <a> to
be both a hyperlink and a fragment identifier.
An easy way to think of a fragment identifier is as the HTML analog of
the goto statement label common in many programming languages. The
name attribute within the <a> tag or the id attribute within the <a> or oth-
Search WWH ::

Custom Search