HTML and CSS Reference
In-Depth Information
Figure 7.3
You will add
hyperlinks to
fragment identifiers
Modify the page as follows:
1. Code a named fragment for each <h2> element in the definition list. For example:
<h2 id="hobbies">Hobbies</h2>
2. Add hyperlinks to the items in the unordered list so that each entry will link to its
corresponding <h2> .
3. Add a named fragment near the top of the page.
4. Near the bottom of the favorites.html page add a hyperlink to the top of the page.
Save the file and test it. Compare your work with the sample found in the student files
(Chapter7/favorites.html).
There may be times when you need to link to a named fragment on another Web page.
To accomplish this, place a "#" followed by the fragment identifier id value after the
file name in the anchor tag. So, to link to the “Professional Groups” (given that it is a
named fragment called “prof”) from any other page on the same Web site, you could
use the following XHTML:
<a href="favorites.html#prof">Professional Organizations</a>
FAQ
Why don't some of my hyperlinks to name fragments work?
A Web browser cannot display less than the height of the browser window. If there is not
enough space left on the bottom of the page below the named reference, it cannot be dis-
played at the top of the page. Try adding some blank lines (use the <br /> tag) to the lower
portion of the Web page. Save your work and test your hyperlinks again.
 
Search WWH ::




Custom Search