Below you can find some Stack Overflow posts around the use and the understanding of position:sticky
.
Few hints to consider if you face any issue with position:sticky
:
- Check if there is
overflow:hidden
defined somewhere in your code. It will preventposition:sticky
from working if applied to an ancestor element. - Don’t forget to set a value of
top
(orbottom/left/right
). There is no default direction for sticky so you need to define it. position:sticky
consider the parent element (containing block) as a reference. Always add border around the element and its parent to understand what’s happening. If both have the same dimension then there is no room for a sticky behavior- You aren’t obliged to always use
0
withtop/bottom/left/right
, you can also use different values and even negative ones.
Stack Overflow posts
Why bottom:0 doesn’t work with position:sticky?
pure CSS multiple stacked position sticky?
If you specify `bottom: 0` for position: sticky, why is it doing something different from the specs?
Why is ‘position: sticky’ not working with Core UI’s Bootstrap CSS
Why position:sticky is not working when the element is wrapped inside another one?
‘position: sticky’ not working when ‘height’ is defined
how to use sticky-top class in bootstrap 4 in grid
bidirectional “sticky” position (how it is working when “fixed”)
How can I create different levels of sticky headers?
Why isn’t position:sticky with left:0 working inside a scrollable container?