How to use fixed positioning for only a little bit

How would i go about using CSS to make a nav menu with absolute positioning then when scrolled a little make it switch to fixed, so the menu always stays at the top. Kind of like this website -Thanks

It’s done exactly as you’ve described, it’s done with javascript. When window.scrollTop is greater than a specific point it adds position: fixed to an element.

That site uses StickyScroller

There’s other implementations like ScrollSpy.

use nav fixed and z-index

Ok, thanks.