9.7 · Layout
Clip without breaking sticky: overflow: clip
Clip content like hidden, without creating a scroll container.
overflow: hidden is the usual way to clip rounded
corners. But it also turns the element into a scroll container, so a
position: sticky header inside it sticks to that box
instead of the page, and appears not to work.
overflow: clip only clips. Sticky keeps working, and the
element can’t be scrolled by script either.
overflow-clip-margin lets content spill a little past the
edge before it’s cut.
.panel {
border-radius: 1rem;
overflow: hidden; /* sticky headers inside stop sticking */
}
.panel {
border-radius: 1rem;
overflow: clip;
}