Sticky Position does not work with Nav Element

I was working in some code to practice CSS positions and I was trying to do a main menu that sticks to the top of the browser when scrolling but the Sticky position was not working at all, I was following this example : Sticky Menu but the guy that made this he used divs and when I changed his div menu for a nav I got the same problem. Why is that? I don’t get it.

position: sticky only works within its relative parent. It`s a common mistake often made. In order to help you, you need to post your code. Please make sure to format your code.

Here is a good explanation of how it works (and what the common mistakes are):

1 Like

Thanks, it helps a lot, (I tried to format my code but life happens) I kinda got a big notion now about what was my issue; thank you.

1 Like