The overscroll-behavior-x property controls what happens when a scrollable element reaches its horizontal edge. It is essential for carousels, tab strips, wide tables, and any panel that scrolls left and right inside a larger page.
The overscroll-behavior-x property in CSS controls the browser’s behavior when the horizontal boundary of a scrolling area is reached.
This property is particularly useful for managing how users interact with elements that have overflow content, such as scrollable containers.
By customizing the overscroll behavior, developers can enhance the user experience by preventing unexpected scrolling actions, such as scrolling the entire page when reaching the end of a scrollable element.
Definition and Usage
Use overscroll-behavior-x on elements that scroll horizontally inside a larger page, such as carousels, tab strips, image galleries, and wide data table wrappers.
Pair it with overflow-x: auto or overflow: auto so the element actually scrolls on the horizontal axis. Then set overscroll-behavior-x: contain to keep horizontal edge scrolling inside that box.
The overscroll-behavior shorthand sets both physical axes at once. In horizontal writing modes, overscroll-behavior-inline is the logical equivalent of the horizontal axis. Use overscroll-behavior-y when you need to control vertical overscroll separately.
💡
Beginner Tip
Create a 300px-wide box with 600px-wide content and overflow-x: auto;. Scroll to the right edge and keep scrolling to feel horizontal scroll chaining, then add overscroll-behavior-x: contain;.
Foundation
📝 Syntax
The syntax for the overscroll-behavior-x property is as follows:
syntax.css
element{overscroll-behavior-x:value;}
It can be applied to any scrollable element. Here, value can be one of the predefined keywords described below.
The element must be scrollable on the horizontal axis, usually with overflow-x: auto or overflow: auto.
overscroll-behavior is a shorthand for overscroll-behavior-x and overscroll-behavior-y.
In horizontal writing mode, overscroll-behavior-inline maps to the same axis as overscroll-behavior-x.
contain is the most common choice for carousels, tab strips, and wide table wrappers.
Defaults
🎯 Default Value
The default value of the overscroll-behavior-x property is auto. This means the default overscroll behavior is applied, allowing the browser to determine how to handle the overscroll interaction.
With auto, scrolling past the left or right edge of a nested scroll area may chain to the page behind it or trigger platform-specific bounce effects.
The default behavior where the scroll boundary event is handled normally.
contain
overscroll-behavior-x: contain;
Prevents scroll chaining, meaning overscroll will not propagate to the parent container. The user will not be able to scroll past the boundaries of the element.
none
overscroll-behavior-x: none;
Prevents both scroll chaining and scroll boundary default actions, ensuring no overscroll effects, like pull-to-refresh, are triggered.
auto — defaultcontain — stop chainingnone — no bounce
Preview
👀 Live Preview
Three scroll boxes with the same wide gradient content and different overscroll-behavior-x values. Scroll each box to its left or right edge:
auto
contain
none
Hands-On
Examples Gallery
Prevent horizontal scroll chaining with contain, compare default auto behavior, disable horizontal bounce with none on a carousel strip, and isolate scroll inside a wide data table wrapper.
🔄 Horizontal Containment
Use overscroll-behavior-x: contain when horizontally scrollable areas should not scroll the page behind them.
Example 1 — Scrollable Container with contain
In this example, we’ll prevent horizontal overscroll propagation when scrolling reaches the boundaries of a div element.
overscroll-x-contain.html
<style>.scrollable-container{width:300px;height:200px;overflow-x:auto;border:1px solid #ccc;overscroll-behavior-x:contain;}.inner{width:600px;}</style><divclass="scrollable-container"><divclass="inner">
This is a scrollable container with horizontal overflow. The overscroll behavior has been set to "contain," so when you reach the end of the scrollable content, the scrolling does not propagate to the parent container.
</div></div>
This is a scrollable container with horizontal overflow. The overscroll behavior has been set to "contain," so when you reach the end of the scrollable content, the scrolling does not propagate to the parent container.
How It Works
In this example, the overscroll-behavior-x: contain; style prevents the parent page from scrolling when the user reaches the left or right edge of the scrollable area.
Example 2 — Default auto Behavior
With overscroll-behavior-x: auto, the browser keeps its normal horizontal overscroll behavior, including scroll chaining where supported.
Section one — scroll inside this panel first.Section two — keep reading until you reach the right edge.Section three — at the edge, extra scroll may move the page.Section four — that is normal default browser behavior.
How It Works
When the panel hits its horizontal scroll boundary, the browser may pass the scroll gesture to the page behind it.
🚫 Bounce & Horizontal UI
Disable horizontal bounce with none on carousels or isolate horizontal scroll inside wide table layouts.
Example 3 — Horizontal Carousel Strip with none
Use overscroll-behavior-x: none when you want to stop both horizontal scroll chaining and overscroll bounce effects on a carousel or tab strip.
The table wrapper scrolls independently on the horizontal axis while edge scrolling does not move the page behind the panel.
Companion
overscroll-behavior vs inline vs y
The overscroll-behavior shorthand sets both physical axes at once. overscroll-behavior-x targets only the horizontal axis (left and right), and overscroll-behavior-y targets only the vertical axis (top and bottom). In horizontal writing modes, overscroll-behavior-inline is the logical equivalent of the horizontal axis.
scroll-companion.css
/* Shorthand — both physical axes */.modal-body{overscroll-behavior:contain;}/* Horizontal axis only */.carousel{overscroll-behavior-y:auto;overscroll-behavior-x:contain;}
A11y
♿ Accessibility
Do not trap users — Preventing horizontal scroll chaining is helpful in carousels and tables, but ensure keyboard users can still navigate horizontally with arrow keys or focus management.
Keep scrollable regions discoverable — Pair overscroll control with visible scroll cues and sufficient contrast on horizontally scrollable content.
Prefer contain on data tables — so background page movement does not disorient screen reader users when scrolling wide tables.
Test touch devices — Horizontal overscroll behavior is especially noticeable on swipe gestures in carousels and tab strips.
🧠 How overscroll-behavior-x Works
1
User scrolls horizontally
A carousel, tab strip, or table wrapper scrolls left and right while content fits inside its bounds.
Scroll
2
Scroll reaches the left or right edge
The inner container can scroll no farther left or right on the horizontal axis.
Boundary
3
overscroll-behavior-x is applied
The browser decides whether to chain horizontal scroll, bounce, or stop at the container edge.
Value
=
🔄
Controlled horizontal overscroll
Horizontally scrollable panels stay isolated from the page behind them when you use contain or none on the X axis.
Compatibility
Browser Compatibility
The overscroll-behavior-x property is supported in most modern browsers, including the latest versions of Chrome, Firefox, Safari, Edge, and Opera. However, it is always recommended to test your implementation across different browsers to ensure consistent behavior.
✓ Baseline · Modern browsers
Strong support in current browsers
auto, contain, and none work reliably in all major evergreen browsers.
95%Global browser support
Google Chrome63+ · 2017 onward
Full support
Mozilla Firefox59+ · 2018 onward
Full support
Apple Safari16+ · macOS & iOS
Full support
Microsoft Edge18+ · Chromium Edge
Full support
Opera50+ · 2018 onward
Full support
overscroll-behavior-x property95% supported
Bottom line:overscroll-behavior-x is dependable for horizontal scroll UX in modern projects.
Wrap Up
Conclusion
The overscroll-behavior-x property is a valuable tool for managing the user experience in scrollable containers.
By controlling how overscroll interactions are handled, developers can prevent undesired scroll chaining and other default browser actions. This property is particularly useful in applications where precise control over horizontal scrolling behavior is needed, such as in mobile applications or single-page web apps.
Use overscroll-behavior-x: contain on carousels, tab strips, and wide table wrappers
Pair with overflow-x: auto or overflow: auto
Test scroll edges on touch devices and trackpads with horizontal gestures
Use none when horizontal bounce effects feel distracting on carousel strips
Combine with the overscroll-behavior shorthand when both axes need the same value
❌ Don’t
Expect overscroll control without a horizontally scrollable container
Apply none everywhere when contain is enough
Confuse overscroll-behavior-x with overflow-x
Forget keyboard navigation for horizontally scrollable regions
Skip cross-browser testing on Safari and mobile Chrome
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about overscroll-behavior-x
Use these points when horizontally scrollable areas reach their edges.
5
Core concepts
🔄01
Physical X Axis
Left and right edges.
Purpose
⚙02
Default auto
Browser defaults.
Default
📝03
Three Values
auto to none.
Values
🚫04
contain Carousels
Stop horizontal chaining.
Use case
↔05
Shorthand Pair
X + Y axes.
Companion
❓ Frequently Asked Questions
overscroll-behavior-x controls what happens when a scrollable element reaches its horizontal boundary, such as whether left-right scroll chains to a parent or triggers bounce effects.
The default value is auto, which means the browser uses its normal overscroll behavior on the horizontal axis, including scroll chaining where supported.
overscroll-behavior-x targets the physical horizontal axis (left and right). overscroll-behavior-y targets the physical vertical axis. overscroll-behavior-inline is the logical equivalent of the horizontal axis in horizontal writing modes. The overscroll-behavior shorthand sets both x and y at once.
Use contain to stop horizontal scroll chaining while still allowing local bounce effects. Use none when you also want to disable horizontal bounce and prevent scroll from propagating to parent elements.
Yes. Modern mobile browsers support overscroll-behavior-x, which is especially useful for horizontal carousels, tab strips, and wide data tables where horizontal overscroll should not move the page behind.