Anchor Links (Linking to a Section or Text)
Anchor links let you jump directly to a specific location on a page using href="#id"
.
This works on the same page or from another page.
Same-Page Anchor Example
<h2 id="contact">Contact Us</h2>
<a href="#contact">Jump to Contact Section</a>
Jump to Contact Section
Back to Top
Different Page Anchor Example
<!-- On target page -->
<h2 id="chapter3">Chapter 3: CSS Basics</h2>
<!-- From another page -->
<a href="/mgu/technology/html_css_js_part_1-3.html#chapter3">
Go to Chapter 3
</a>
Contact Us
You have successfully jumped to the Contact section using an anchor link!