How does the "position: sticky;" property work?

Harleyoc1 picture Harleyoc1 · Apr 30, 2017 · Viewed 318.9k times · Source

I want to make the Navigation Bar stick to the top once I scroll to it, but it's not working and I have no clue why. If you can please help, here is my HTML and CSS code:

Answer

MarsAndBack picture MarsAndBack · Dec 19, 2017

Check if an ancestor element has overflow set (e.g. overflow:hidden); try toggling it. You may have to go up the DOM tree higher than you expect =).

This may affect your position:sticky on a descendant element.