overflow
Widely availableSince 201597% of users
Decides what happens when content is too big for its box: it can spill out, get cut off or scroll. One value sets both directions, and two values set x then y.
What's modern
From web-features, MDN's browser data and our snippets, checked dailyClassic, with newer partsIt has worked everywhere since July 2015, and it keeps getting newer values.
Newer parts of overflow
clipBaseline Sept 2022, Widely Mar 2025Multiple keyword syntax for overflow-x and overflow-yBaseline Mar 2020, Widely Sept 2022
See how modern your own CSS is.Check your CSS →
Quick facts
- Initial value
visible- Inherited
- No
- Applies to
- block, flex, and grid containers
- Animation type
- discrete
Quick example
.panel {
max-height: 20rem;
overflow: auto;
}Values
visiblehiddenclipscrollautoExamples
Scroll only when needed
.chat-log {
height: 24rem;
overflow: auto;
}auto shows a scrollbar only when the content is bigger than the box.
Clip without a scroll container
.card {
border-radius: 1rem;
overflow: clip;
}clip cuts off anything outside the box, like hidden. Unlike hidden, the box can't be scrolled at all, even from script.
A different value per axis
.carousel {
overflow: auto hidden;
}The first value sets overflow-x and the second sets overflow-y. This row scrolls sideways and hides anything that sticks out above or below.
Common pitfalls
- visible turns into autoIf one axis is hidden, scroll or auto, a visible value on the other axis computes to auto. You get a scrollbar instead of content spilling out. To cut off one axis and let the other spill, use clip instead of hidden.
- Scroll containers change where sticky stickshidden, scroll and auto turn the box into a scroll container. A position: sticky element inside it then sticks within that box instead of the page, which can look like sticky stopped working. clip does not do this.
- hidden can still scrolloverflow: hidden removes the scrollbars, but script can still scroll the box, for example with scrollTo() or scrollIntoView(). Use clip if it must never scroll.
overflow browser support
BaselineWidely availableThis feature is well established and works across many devices and browser versions. It has been available across browsers since 2015.Safe to use without fallbacks.
Usage97%of people can use this3% use a browser without it.
Browsers
1+
1+
1+
12+Mobile
18+Android
4+Android
1+iOS