Bookmark Anchors


Bookmark anchors are created, so that users can jump at specific sections of webpage. If you have a very long webpage, then bookmarks help a lot to move from one section of webpage to other.

To create a bookmark first we have to add id attribute on the target element. Then the value of id attribute is used in href tag of <a> preceded by a hash(#) sign.


As shown in the following example:


<a href="#sectionF"> Jump to Section F </a>
<h1 id="sectionA"> Section A </h1>
<h1 id="sectionB"> Section B </h1>
<h1 id="sectionC"> Section C </h1>
<h1 id="sectionD"> Section D </h1>
<h1 id="sectionE"> Section E </h1>
<h1 id="sectionF"> Section F </h1>

Live Demo!



Tip: Anchor tag with element id of target can also be used to jump to a specific section of another webpage, for example:


<a href="https://en.wikipedia.org/wiki/HTML#HTML_5">Go to HTML 5 Wikipedia</a>

Live Demo!