HTML links can be used to create bookmarks, allowing readers to navigate to specific parts of a web page.
Bookmarks can be beneficial for long web pages.
They are widely used to create menus and navigation systems for single page websites or long web pages.
Create a Bookmark
To create a bookmark, you need to first define the bookmark location, then add a link to it.
Clicking on the link will scroll the page to the bookmarked location.
For example, use the id
attribute for an <h2>
element to create a bookmark.
<h2 id="about">About Us</h2>
Then, include a link to the bookmark within the same page, for example, place it on a menu item "About Us" as shown in the code and image below.
<ul>
<li><a href="#about">About Us</a></li>
</ul>
Clicking on the "About Us" link in the menu, will scroll the page to the "About Us" section in the page content.
You can also include a link to a bookmark on a different page, as shown in the code below.
<a href="/contact/#about">About Us</a>
Please check below options for the links to our previous or next tutorial.