CSS <overflow> Data Type
The <overflow> data type is an overflow keyword: visible, hidden, clip, scroll or auto, which sets what happens to content that doesn't fit.
Description
The <overflow> CSS data type represents the keywords that control what happens when an element's content is too big to fit inside its box. It is the value type of the overflow shorthand and its longhands overflow-x and overflow-y, as well as the logical properties overflow-block and overflow-inline.
The keywords fall into two groups. visible and clip do not create a scroll container: with visible, the default, overflowing content simply spills outside the box, and with clip it is cut off at the edge with no way to scroll to it. hidden, scroll and auto all turn the element into a scroll container. hidden cuts off the content but still allows it to be scrolled with code (for example with JavaScript or by focusing an element inside); scroll always shows scrollbars; and auto shows scrollbars only when they are needed.
The difference between hidden and clip is important in practice. Because hidden creates a scroll container, it affects position: sticky on descendants and creates a new block formatting context. clip avoids both, which makes it a good choice when you only want to trim content visually, and it can be combined with overflow-clip-margin to let content extend slightly past the edge. The overflow shorthand accepts one or two <overflow> values; with two, the first applies to the x axis and the second to the y axis.
Examples:
/* Scroll only when needed */
.chat-log {
height: 300px;
overflow: auto;
}
/* Hide horizontal overflow, allow vertical scrolling */
.code-panel {
overflow: hidden auto;
}
/* Trim an image to rounded corners without a scroll container */
.avatar {
border-radius: 50%;
overflow: clip;
}
/* Always show scrollbars to avoid layout shift */
.sidebar {
overflow-y: scroll;
}
Choosing the right <overflow> keyword keeps content accessible while preventing layouts from breaking when text, images or user content is larger than expected.
Interactive Demo
Syntax
<overflow> = visible | hidden | clip | scroll | auto
Values
- visibleContent is not clipped and may be drawn outside the element's padding box. This is the default value.
- hiddenContent is clipped to the padding box and no scrollbars are shown, but the element is still a scroll container and can be scrolled programmatically.
- clipContent is clipped at the overflow clip edge. The element is not a scroll container and cannot be scrolled, even programmatically.
- scrollContent is clipped and scrollbars are always shown, whether or not the content overflows.
- autoContent is clipped and scrollbars are shown only when the content overflows.
Example
Browser Support
The following information will show you the current browser support for the CSS overflow data type. Hover over a browser icon to see the version that first introduced support for this CSS data type.
Desktop





Tablets & Mobile





