G.6. Internal Linking
In Appendix F, we discussed how to hyperlink one Web page to another. Figure G.6 introduces internal linkinga mechanism that enables the user to jump between locations in the same document. Internal linking is useful for long documents that contain many sections. Clicking an internal link enables users to find a section without scrolling through the entire document.
Figure G.6. Internal hyperlinks to make pages more navigable.
Line 16 contains a tag with the id attribute (called "features") for an internal hyperlink. To link to a tag with this attribute inside the same Web page, the href attribute of an anchor element includes the id attribute value preceded by a pound sign (as in #features). Lines 6162 contain a hyperlink with the id features as its target. Selecting this hyperlink in a Web browser scrolls the browser window to the h1 tag in line 16.
Although not demonstrated in this example, a hyperlink can specify an internal link in another document by specifying the document name followed by a pound sign and the id value, as in:
href = "filename.html#id"
For example, to link to a tag with the id attribute called booklist in books.html, href is assigned "books.html#booklist".