Skip to content
CSS·Advanced·Conceptual·1 min read

How does position: sticky choose its scroll container?

Short interview answer

It sticks relative to the nearest ancestor with a relevant scrolling mechanism and requires an inset. Overflow ancestors commonly explain apparently broken sticky behavior.

Key takeaway

Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.

← Back to CSS layout

Related questions