<nav class="anchor-nav">
<a href="#section1">Section 1</a>
<a href="#section2">Section 2</a>
<a href="#section3">Section 3</a>
</nav>
<div class="content-box">
<section id="section1" style="background:#eff6ff"><h2>Section 1</h2></section>
<section id="section2" style="background:#f0fdf4"><h2>Section 2</h2></section>
<section id="section3" style="background:#fff7ed"><h2>Section 3</h2></section>
</div>
Back to Snippets
Smooth Scroll to Anchor JS
Create a premium navigation experience with smooth scrolling. When users click an anchor link, the page glides gently to the target section instead of jumping instantly, which helps them maintain context.
381