In brief
With position: sticky, top sets the upper threshold at which an element is held within its scrolling area. top: 0 is a common starting point for a sticky heading.
Useful to know
With position: sticky, top sets the upper threshold at which an element is held within its scrolling area. top: 0 is a common starting point for a sticky heading. [1]
The threshold concerns the relevant scrolling container, not necessarily the window. If the heading sticks in an unexpected place, inspect ancestor overflow rather than arbitrarily increasing the number.
Sources
For further detail and to check the information: