HTML bookmarks enable readers to navigate directly to specific sections of a webpage.
Bookmarks prove particularly helpful for lengthy pages.
To employ a bookmark, it must first be created, followed by adding a link to it.
Subsequently, clicking the link will prompt the page to scroll to the bookmarked location.
Example
Initially, generate a bookmark utilizing the id attribute.
<h2 id=”C4″>Chapter 4</h2> |
Next, include a link to the bookmark (“Jump to Chapter 4”) within the same page.
Example
<a href=”#C4″>Jump to Chapter 4</a> |
Alternatively, add a link to the bookmark (“Jump to Chapter 4”) from a different page.
<a href=”html_demo.html#C4″>Jump to Chapter 4</a> |