How to create a link to jump to a specific part of a page in HTML?

Give the target element an id, and put #id in the link. This works for the same page and for another page.

<!-- same page -->
<a href="#pricing">See pricing</a>
<h2 id="pricing">Pricing</h2>

<!-- another page -->
<a href="plans.html#pricing">Pricing on the plans page</a>

For a smooth scroll instead of a sudden jump, add this CSS.

<style>
  html { scroll-behavior: smooth; }
</style>

See also links to sections within the same page and HTML class and id.


Learn more about the similar topics:
Tutorials
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.