HTML and CSS Reference
The Byrd section.
Linking to Anchors in the Same Document
What if you have only one large page, and you want to link to sections within that page?
You can use anchors for it, too. For larger pages, using anchors can be an easy way to
jump around within sections. To link to sections, you just need to set up your anchors at
each section the way you usually do. Then, when you link to those anchors, leave off the
name of the page itself but include the hash sign and the name of the anchor. So, if
you're linking to an anchor name called section5 in the same page as the link, the link
looks like the following:
Go to < a href = ”#section5” >The Fifth Section< /a >
When you leave off the page name, the browser assumes that you're linking with the cur-
rent page and scrolls to the appropriate section. You'll get a chance to see this feature in
action in Lesson 7. There, you create a complete web page that includes a table of con-
tents at the beginning. From this table of contents, the reader can jump to different sec-
tions in the same web page. The table of contents includes links to each section heading.
In turn, other links at the end of each section enable the user to jump back to the table of
contents or to the top of the page.
So far in this topic, you've encountered URLs twice: in Lesson 1, “Navigating the World
Wide Web,” as part of the introduction to the Web; and in this lesson, when you created
links to remote pages. If you've ever done much exploring on the Web, you've encoun-
tered URLs as a matter of course. You couldn't start exploring without a URL.