position: sticky
only does something if you have one of top
, bottom
, left
, or right
set, so maybe that’s your problem? Something like top: 0
is typical to stick things to the very top of the screen.
You may have further issues doing this though, because sticky
doesn’t really work well on elements that are contained inside height-constrained containers like the header. For example, it’s probably easier to get sticky working on header
(which is contained in the body
), rather than the nav
inside header
. You may need to move things around or change other styles if you want to do this with the nav specifically.