Need help with sticky nav

Hi I am so close to finishing this project but I am stuck on how to make my navbar sticky.

Can someone help?

1 Like

Hi. First of all, at first glance, your project looks really nice. I think position: fixed; should do the work.

The obvious solution is that the div around your nav needs to be position: sticky.

Hey thanks for your response! :slight_smile:

Yes I have .header__navbar set to position: fixed, but it doesn’t seem to be doing anything. So I think there is something I don’t understand correctly.

It works when I add fixed positioning to the #header but the whole top section ends up being sticky and that’s not what I want

Where should I set the position to fixed?

i found the solution, in the css u have two " .header__navbar" one with position relative and the second with position fixed… delete the shorter and change the position of the second in fixed, and also set a background-color to see the bar.

U also need to set in the class “.header__cover-cta” a position: relative and set top:150px or your bar will cover the background and the form

1 Like

Thank you for sharing this solution.

I actually had gone back and took some of the content out of my header and just left the nav elements in there. After adjusting some of the css I was able to find another solution.

However, I would like to try the approach you mentioned as well so I can see how another solution would work. Thanks again for your time!

1 Like