overflow
The overflow CSS property sets the behavior for when content doesn't fit in an element.
Overview
The overflow CSS property sets the behavior for when content doesn't fit in an element.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 1 | 12 | 1 | 1 | 18 | 1 | |
| Other | ||||||
| The overflow-x CSS property sets what shows when content overflows a block-level element's left and right edges. This may be nothing, a scroll bar, or the overflow content. This property may also be set by using the overflow shorthand property. | 1 | 12 | 3.5 | 3 | 18 | 1 |
| CSS property | ||||||
auto | 1 | 12 | 3.5 | 3 | 18 | 2 |
hidden | 1 | 12 | 3.5 | 3 | 18 | 2 |
scroll | 1 | 12 | 3.5 | 3 | 18 | 2 |
visible | 1 | 12 | 3.5 | 3 | 18 | 2 |
| Other | ||||||
| The overflow-y CSS property sets what shows when content overflows a block-level element's top and bottom edges. This may be nothing, a scroll bar, or the overflow content. This property may also be set by using the overflow shorthand property. | 1 | 12 | 3.5 | 3 | 18 | 1 |
| CSS property | ||||||
auto | 1 | 12 | 3.5 | 3 | 18 | 2 |
hidden | 1 | 12 | 3.5 | 3 | 18 | 2 |
scroll | 1 | 12 | 3.5 | 3 | 18 | 2 |
visible | 1 | 12 | 3.5 | 3 | 18 | 2 |
auto | 1 | 12 | 1 | 3 | 18 | 2 |
hidden | 1 | 12 | 1 | 3 | 18 | 2 |
multiple keywords Multiple keyword syntax for `overflow-x` and `overflow-y` | 68 | 79 | 61 | 13.1 | 68 | 13.4 |
scroll | 1 | 12 | 1 | 3 | 18 | 2 |
visible | 1 | 12 | 1 | 3 | 18 | 2 |
| Other | ||||||
| The enumerated value type represents the keyword values for the overflow-block, overflow-inline, overflow-x, and overflow-y longhand properties and the overflow shorthand property. These properties apply to block containers, flex containers, and grid containers. | 1 | 12 | 1 | 1 | 18 | 1 |
- After Firefox 3.6, the `overflow` property is correctly applied to table group elements (`<thead>`, `<tbody>`, `<tfoot>`).
- Previously available under a different name: overlay (15)
- Previously available under a different name: overlay (112)
- Previously available under a different name: overlay (6)
- Before Safari 12.1, `overlay` only had an effect on legacy scrollbars on macOS. Since Safari 12.1, it is parsed as `auto`.
- Previously available under a different name: overlay (100)
- Previously available under a different name: overlay (6)
- Before Safari on iOS 12.1, `overlay` only had an effect on legacy scrollbars on macOS. Since Safari on iOS 12.1, it is parsed as `auto`.
- Previously available under a different name: overlay (15)
- Previously available under a different name: overlay (112)
- Previously available under a different name: overlay (6)
- Before Safari 12.1, `overlay` only had an effect on legacy scrollbars on macOS. Since Safari 12.1, it is parsed as `auto`.
- Previously available under a different name: overlay (100)
- Previously available under a different name: overlay (6)
- Before Safari on iOS 12.1, `overlay` only had an effect on legacy scrollbars on macOS. Since Safari on iOS 12.1, it is parsed as `auto`.
- Previously available under a different name: overlay (114)
- Previously available under a different name: overlay (112)
- Previously available under a different name: overlay (12)
- Previously available under a different name: overlay (114)
- Previously available under a different name: overlay (12)
Syntax
.scroll-box {
overflow: auto;
}
.hidden-box {
overflow: hidden;
} Live demo
Use cases
Using overflow
The overflow CSS property sets the behavior for when content doesn't fit in an element.
Cautions
- May not be supported in older browsers.
Accessibility
- Make sure visual changes are conveyed appropriately to assistive technology.
Related links
Powered by web-features