As @alex said a scrolling box is a box where the value of overflow is set to a value different from visible
(the default one). I cannot confirm but I concluded this based on this previous answer where overflow is creating some issues with sticky element.
As I explained there, if you have an element with overflow:hidden
as an ancestor of the position:sticky
this one will stop working because its offset will be calculated based on that box (with overflow:hidden
) because it's the nearest ancestor with a scrolling box. Since we used hidden
we cannot scroll this box so we cannot see the sticky behavior.
Here is a basic example:
.wrapper {
height:200vh;
border:2px solid;
}
.wrapper >div {
position:sticky;
top:0;
height:20px;
background:red;
}
<div class="wrapper">
<div></div>
</div>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…