Widely availableSupported across all major browsers. Safe to use in production.

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
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 1 item(s)
Implementation note
  • After Firefox 3.6, the `overflow` property is correctly applied to table group elements (`<thead>`, `<tbody>`, `<tfoot>`).
Notes 1 item(s)
Implementation note
  • Previously available under a different name: overlay (15)
Notes 1 item(s)
Implementation note
  • Previously available under a different name: overlay (112)
Notes 2 item(s)
Implementation note
  • 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`.
Notes 1 item(s)
Implementation note
  • Previously available under a different name: overlay (100)
Notes 2 item(s)
Implementation note
  • 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`.
Notes 1 item(s)
Implementation note
  • Previously available under a different name: overlay (15)
Notes 1 item(s)
Implementation note
  • Previously available under a different name: overlay (112)
Notes 2 item(s)
Implementation note
  • 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`.
Notes 1 item(s)
Implementation note
  • Previously available under a different name: overlay (100)
Notes 2 item(s)
Implementation note
  • 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`.
Notes 1 item(s)
Implementation note
  • Previously available under a different name: overlay (114)
Notes 1 item(s)
Implementation note
  • Previously available under a different name: overlay (112)
Notes 1 item(s)
Implementation note
  • Previously available under a different name: overlay (12)
Notes 1 item(s)
Implementation note
  • Previously available under a different name: overlay (114)
Notes 1 item(s)
Implementation note
  • Previously available under a different name: overlay (12)

Syntax

CSS
.scroll-box {
  overflow: auto;
}
.hidden-box {
  overflow: hidden;
}

Live demo

overflow: auto

CSS Overflow: auto demo.

PreviewFullscreen

overflow: hidden

CSS Overflow: hidden demo.

PreviewFullscreen

overflow: scroll

CSS Overflow: scroll demo.

PreviewFullscreen

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.

Powered by web-features