CSS Div Position Fixed Relative to Top of Viewport Only

Viewed 10948

Is there a way using CSS to make a div's position property fixed relative only to the top of the viewport? What I am trying to do is make a navigation bar that scrolls up and down with the webpage.

position: fixed 

works fine for this, except that it creates a problems when the page size is small, since the user cannot scroll horizontally to access the navigation bar options that are offscreen.

Also open to other non-CSS solutions, but if there is something simple I can implement in CSS that would be preferable. Thanks!

1 Answers
Related