HTML and CSS Reference
In-Depth Information
separated by the pound sign ( # ). A fragment identifier indicates to the
browser that it should begin displaying the target document at the indic-
ated fragment name. As we describe in more detail later in this chapter,
you insert fragment names into a document either with the universal
id tag attribute or with the name attribute for the <a> tag. In the follow-
ing example, the browser loads the file named kumquat_locations.html
from the www.kumquat.com server, and then displays the document
starting at the section of the page named Northeast:
http://www.kumquat.com/kumquat_locations.html#Northeast
Like a pathname, a fragment name may be any sequence of characters,
as long as you are careful with spaces and other symbolic characters.
The fragment name and the preceding hash symbol are optional; omit
them when referencing a document without defined fragments.
Formally, the fragment element applies only to HTML and XHTML doc-
uments. If the target of the URL is some other document type, the
browser may misinterpret the fragment name.
Fragments are useful for long documents. By identifying key sections
of your document with a fragment name, you make it easy for readers
to link directly to that portion of the document, avoiding the tedium of
scrolling or searching through the document to get to the section that
interests them.
As a rule of thumb, we recommend that every section header in your
documents be accompanied by an equivalent fragment name. By con-
sistently following this rule, you'll make it possible for readers to jump
to any section in any of your documents. Fragments also make it easier
to build tables of contents for your document families.
 
Search WWH ::




Custom Search