HTML and CSS Reference
In-Depth Information
Figure 7.2
The “skip to
content” link in
(sometimes called a hash mark) before the name of the fragment identifier. The
XHTML for a hyperlink to the named fragment "content" is
<a href="#content">Skip to Page Content>
The hash mark indicates that the browser should search for an id on the same page. If
you forget to type the hash mark, the browser will not look on the same Web page; it
will look for an external file. See Chapter 5 (Figures 5.24, 5.38, and 5.39) for more
examples of “Skip to Content” or “Skip Navigation” hyperlinks. A named fragment does
not have to be at the beginning of page content; it can be just about anywhere that
would be useful to your Web visitors.
Legacy Alert. Fragment identifiers are not part of HTML 4, but you may find references
to named anchors. Named anchors used the now-deprecated name attribute to identify
or name the fragment. For example, <a name="content" id="content"></a>.
You will work with fragment identifiers in this Hands-On Practice. Locate the
Chapter7/starter1.html file in the student files. Figure 7.3 shows a partial screenshot of
this Web page.
Launch Notepad and open the starter1.html file. Save the file as favorites.html.
Examine the source code and notice that the top portion of the page contains an
unordered list with categories of interest (such as Hobbies, XHTML, CSS, and
Professional Organizations) that correspond to the text displayed in the <h2> elements
below. After each <h2> element is a definition list of topics and URLs related to that
category. It might be helpful to Web page visitors if they can click a category item and
immediately jump to the page area that has information related to that item. This could
be a useful application of linking to fragment identifiers!
Search WWH ::

Custom Search