Skip to content
Justice Tech School

Page Bookmarks

Give an element an id, then link to it with href="#id". The browser scrolls to that element. This is how "back to top" links and tables of contents work.

Example
<p><a href="#bottom">Jump to the bottom</a></p>
<div style="height: 200px; background: #f1f5f9">Some space</div>
<h2 id="bottom">You made it</h2>
<p><a href="#top">Back to top</a></p>

Exercise

Link to the element with id "contact".

<a href="contact">Contact</a>

Quiz Test

Which symbol begins a link to an id on the same page?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.