Linking to specific spots within a page can be useful on long pages with multiple sections. To create a link that jumps people who click it to a specific part of the page, you need 2 things:
- An anchor
- A link
The anchor goes in the place on the page you want to jump to. To add an anchor edit the source code and add a unique id attribute to any tag.
<h2 id="jump-here">Content Heading
If there is no element in the source code to add the id attribute to, you can add an <a> tag without a source attribute, like so:
The link will be formatted with a pound sign in front of the anchor text.
If the link and the anchor are on the same page, your link path needs to simply contains the anchor, like so:
<a href="#jump-here">Link further down the page
If you’re linking from another page on your site, your link path will be a normal relative path followed by the anchor, like so:
<a href="/about"#jump-here">Link to specific section on another page
If you’re linking to an anchor in a completely different website, your link path will be the normal absolute path followed by the anchor, like so:
<a href="http://example.com/about#jump-here">Link to specific section on another website.