<!-- From: https://medium.com/@TusharKanjariya/this-navbar-trick-needs-no-js-1c91c9a8b7a6-->
<!-- NAVBAR -->
<header id="navbar">
<div class="nav-inner">
<span class="nav-logo">CSS.tricks</span>
<ul class="nav-links">
<li><a href="#how">How it works</a></li>
<li><a href="#code">The code</a></li>
<li><a href="#support">Browser support</a></li>
</ul>
<a href="https://medium.com/@TusharKanjariya" target="_blank" class="nav-cta">Medium</a>
</div>
</header>
<!-- HERO -->
<section class="hero">
<span class="hero-badge">Sticky Navbar · No JS Needed</span>
<h1 class="hero-title">
A navbar that <em>slides in</em> — zero JS required
</h1>
<p class="hero-sub">
Scroll down to see it appear. Powered entirely by CSS scroll-state detection.
</p>
<div class="scroll-hint">
<span>Scroll to trigger</span>
<div class="scroll-arrow"></div>
</div>
</section>
<hr class="divider" />
<!-- HOW IT WORKS -->
<div class="section" id="how">
<p class="section-label">The trick</p>
<h2>How this works with no JavaScript</h2>
<div class="notice">
<div class="notice-dot"></div>
<p>The navbar above just slid in as you scrolled — using <strong>CSS scroll-state detection</strong>. No
event listeners. No class toggling. Here's how.</p>
</div>
<p>
Modern CSS can detect the exact moment a sticky element becomes "stuck." When your header locks to the top
of the viewport, CSS notices — and you can style it differently from that point on.
</p>
<p>
No scroll listener firing on every tick. No manual state. Just the browser's layout engine doing what it was
built to do.
</p>
<div class="steps">
<div class="step">
<div class="step-num">01</div>
<div>
<h3>Make the header sticky</h3>
<p>position: sticky + top: 0. The browser now internally tracks when it enters its "stuck" state.
</p>
...