How position: sticky works

Positioned according to the normal flow of document
Offset relative to nearest scrolling ancestor and containing block

Creates new stacking context
Stuck when it meets the oppsite edge of its containing element

参考

https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block

digglue inc. M Building 8F, Tenjincho, Shinjuku, Tokyo

en_USEN
Scroll to Top