layout

overflow

Determines what happens when content exceeds its box's boundaries. Setting overflow to anything but visible creates a new block formatting context.

overflow: visible | hidden | clip | scroll | auto

Common values

Value Effect
visible Default; overflowing content is drawn outside the box
hidden Clips overflow and hides scrollbars
clip Like hidden but disables all scrolling (even programmatic)
scroll Always shows scrollbars, even if not needed
auto Adds scrollbars only when content overflows

Examples

.card { overflow: hidden; border-radius: 12px; }

Clips child content to rounded corners

.scroll-panel { overflow-y: auto; max-height: 300px; }

Vertical scrollbar appears only when needed

pre { overflow-x: auto; }

Horizontal scroll for wide code blocks

Gotcha

overflow: hidden on the body can break position: sticky descendants because sticky needs a scrolling ancestor.

Related properties

← All CSS properties · CSS selectors · Grid vs Flexbox