CSS overscroll-behavior-x Property

Beginner
⏱️ 6 min read
📚 Updated: Jun 2026
🎯 4 Examples
Layout & Scrolling

What You’ll Learn

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.

01

Physical X Axis

Left and right edges.

02

Three Values

auto to none.

03

Default auto

Browser defaults.

04

Scroll Chaining

Stop parent scroll.

05

Carousels & Tables

Horizontal scroll UI.

06

Physical Y Axis

Vertical counterpart.

Introduction

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;.

📝 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.

Basic Example

overscroll-behavior-x.css
.scrollable-container {
  width: 300px;
  height: 200px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

Syntax Rules

  • Accepted values: auto, contain, and none.
  • 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.

🎯 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.

⚡ Quick Reference

QuestionAnswer
Initial valueauto
Applies toNon-replaced block and inline elements
InheritedNo
AnimatableNo
Physical axisHorizontal (left / right)
Common useCarousels, tab strips, image galleries, wide data tables, horizontal scroll panels

💎 Property Values

ValueExampleDescription
autooverscroll-behavior-x: auto;The default behavior where the scroll boundary event is handled normally.
containoverscroll-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.
noneoverscroll-behavior-x: none;Prevents both scroll chaining and scroll boundary default actions, ensuring no overscroll effects, like pull-to-refresh, are triggered.
auto — default contain — stop chaining none — no bounce

👀 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

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>

<div class="scrollable-container">
  <div class="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>
Try It Yourself

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.

overscroll-x-auto.css
.panel {
  width: 300px;
  overflow-x: auto;
  overscroll-behavior-x: auto;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
}
Try It Yourself

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.

overscroll-x-none.css
.carousel {
  width: 320px;
  overflow-x: auto;
  overscroll-behavior-x: none;
  border: 1px solid #334155;
  border-radius: 0.75rem;
}
Try It Yourself

How It Works

Neither the carousel strip nor the page responds to horizontal overscroll actions at the container edges.

Example 4 — Wide Data Table Wrapper

Keep horizontal scroll inside a wide data table wrapper with overscroll-behavior-x: contain so the page behind stays still.

table-scroll.css
.table-wrapper {
  max-width: 360px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
}
Try It Yourself

How It Works

The table wrapper scrolls independently on the horizontal axis while edge scrolling does not move the page behind the panel.

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;
}

♿ 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.

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 Chrome 63+ · 2017 onward
Full support
Mozilla Firefox 59+ · 2018 onward
Full support
Apple Safari 16+ · macOS & iOS
Full support
Microsoft Edge 18+ · Chromium Edge
Full support
Opera 50+ · 2018 onward
Full support
overscroll-behavior-x property 95% supported

Bottom line: overscroll-behavior-x is dependable for horizontal scroll UX in modern projects.

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.

💡 Best Practices

✅ Do

  • 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

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
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.

Practice in the Live Editor

Open the HTML editor and experiment with overscroll-behavior-x: contain, auto, and none on horizontally scrollable areas.

HTML Editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful