How to Anchor Web Pages
Anchors provide reference points within HTML documents that become useful when you want to link to a specific portion of a Web page. You can use anchors to build a table of contents for a long Web page or add "Go Back to Top" links at the bottom of your pages. Anchors also work for content on other Web pages; just link to the page that contains the anchor and add the anchor to the link.
Instructions
-
-
1
Go to "Start," and enter "Notepad" in the search box. Press the "Enter" key to load Notepad, and go to "File" on the top menu. Select "Open...," and browse through your computer's files until you find your Web page. The file for your Web page will usually end in the HTML extension.
-
2
Locate the section of your Web page that you want to anchor. Headers work well as anchors, for example, though you can also anchor paragraphs or whole divs. Add the "ID" attribute to the tags wrapping around the text you want to anchor:
<h1 id="myheading">My Heading</h1>
When the tag already has an "ID" attribute, do not add a second one or change its name. Use the ID name that is already in use.
-
-
3
Add this code to link to your anchored text:
<a href="#myheading">Go Back to My Heading</a>
Change "myheading" to match the ID name of the tags you want to target. Replace the text between the "<a>" tags with whatever text you want to use for the link. Use this code instead when you want to link to anchored text on a separate page:
<a href="path/to/page.html#myheading">
-
1
Tips & Warnings
Target a single word or small section of your Web page by adding "<a>" tags with an ID name around the content.
Avoid use of the "name" attribute when adding anchors to Web pages, because use of "name" in anchors is deprecated in XHTML and HTML five.