Is there a CSS-only way to fix a nav bar (or any element really) below a header, but at the top of the page when scrolling past the header?
I know how to do it with js, I was just curious if there was a clever way to do it with CSS.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, you can’t conditionally style elements based on the scroll value of the page, simply because CSS doesn’t care, and doesn’t measure that parameter. JavaScript however does. So your solution would have to involve JavaScript.