The overflow-x property controls what happens when content overflows a block-level element’s left and right edges. You can let it paint outside, clip it, or allow horizontal scrolling.
The initial value is visible. It is the horizontal half of the overflow shorthand; pair it with overflow-y when axes must differ. The box needs a limited width (or similar constraint) or nothing overflows horizontally.
Baseline · Widely available.
Not deprecated. Core keywords are standard-track. clip is widely available in modern browsers (Chrome 90+, Firefox 81+, Safari 16+). Deprecated / discouraged:overlay is a legacy alias for auto — do not use it in new code.
Set overflow-x to scroll. The element is always a horizontal scroll container.
Clip at the padding box. Extra width stays inside the scrollable area.
Expect scrollbar UI. Many browsers reserve horizontal scrollbar space even when content fits, which avoids layout jump.
Prefer auto for most UI. Use scroll when you want the horizontal track to stay stable.
Edge Cases & Pitfalls
If horizontal overflow looks wrong, one of these is usually why.
width
No width limit, no overflow
Block boxes grow with content by default. Set a width or max-width before judging the keyword.
axes
visible can compute to auto
If overflow-y is hidden, scroll, or auto, a paired overflow-x: visible is computed as auto. Check both axes when results look unexpected.
wrap
Wrapping removes horizontal overflow
Normal text wraps at spaces. Use a long unbroken string, or white-space: nowrap, when you want to study horizontal overflow itself.
hidden
hidden is not the same as clip
Both clip horizontally. clip is not a scroll container and blocks programmatic scrolling. Prefer clip only when you want a hard non-scrolling clip.
overlay
overlay is discouraged
Treat overlay as a deprecated legacy alias of auto. Use auto in new CSS.
Compatibility
Browser Support
overflow-x is a browser CSS property for horizontal clipping and scrolling. Node.js, Deno, and Bun do not apply it.
✓ Baseline · Widely available
overflow-x
Core values work in all modern browsers and Internet Explorer. overflow-x: clip needs Chrome 90+, Firefox 81+, Safari 16+, Edge 90+.
97%Core keyword support
Google ChromeAll · clip 90+
Full support
Mozilla FirefoxAll · clip 81+
Full support
Apple SafariAll · clip 16+
Full support
Microsoft EdgeAll · clip 90+
Full support
OperaModern · clip 76+
Full support
Samsung InternetAll · clip 15+
Full support
Internet Explorer6+ · No clip
Partial
overflow-xWidely supported
Bottom line: Safe for visible, hidden, scroll, and auto everywhere you teach CSS. Use clip in modern browsers; fall back to hidden when needed. It is not a runtime API.
Remember
Key Takeaways
Role: control horizontal overflow on the left and right edges only.
Initial value:visible. Constrain width or nothing overflows.
auto vs scroll: auto when needed; scroll to keep a stable horizontal track.
Pair with overflow-y: a non-visible vertical value can change how visible computes.
One line: constrain width first, then pick a keyword — without a width limit, horizontal overflow never shows.
Frequently Asked Questions
It controls what happens when content is too wide for the element's padding box on the left and right edges: show it, clip it, or allow horizontal scrolling.
The initial value is visible. Content can paint outside the box horizontally, and the element is not a horizontal scroll container by itself.
overflow is the shorthand for both axes. overflow-x sets only the horizontal axis; overflow-y sets only the vertical axis.
scroll typically keeps a horizontal scrollbar track visible even when content fits. auto shows a horizontal scrollbar only when content actually overflows.
If overflow-y is hidden, scroll, or auto, a paired overflow-x: visible is computed as auto. Browsers do not keep one axis fully visible while the other is a scroll/clip mode.
Core values are Baseline Widely available across modern browsers and Internet Explorer. overflow-x: clip needs Chrome 90+, Firefox 81+, or Safari 16+. It is a browser CSS property, not a Node.js feature.