Overflow

Also called overflow: hidden or overflow: auto

A CSS property that decides what happens when content is bigger than its box: spill out, get clipped, or scroll inside it.

What is Overflow?

When content does not fit its box, overflow decides what to do. visible, the default, lets it spill out over whatever comes next. hidden clips it at the edge. scroll makes the box scrollable and always reserves room for scrollbars, while auto shows scrollbars only when the content actually overflows. overflow-x and overflow-y set each direction on its own.

Use auto for panels with a fixed height, such as a chat history or a long sidebar list, and overflow-x: auto for wide tables on phones. Use hidden to crop images to a card’s rounded corners or to keep a decorative shape from making the page scroll sideways.

Watch for side effects. hidden on a parent also cuts off dropdowns and tooltips inside it, and hidden, scroll, and auto all make the parent the box that position: sticky children stick inside. If a phone page scrolls sideways, find the element that is too wide before hiding overflow on body; overflow: clip crops without creating a scroll container.

All terms

Sticky header

A top bar that stays pinned to the top of the screen while the page scrolls underneath it, so navigation is always one click away.

Z-index

A CSS property that decides which element appears on top when elements overlap, with higher numbers sitting closer to the viewer.

Scroll snap

A CSS feature that makes a scroll container settle on set points, so carousels and full-screen sections come to rest neatly on an item.

Horizontal scroll section

A pinned section where scrolling down moves a row of cards sideways, turning vertical scrolling into horizontal movement.