CSS overscroll-behavior Property

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

What You’ll Learn

The overscroll-behavior property controls what happens when a scrollable element reaches its edge. It is essential for modals, sidebars, chat panels, and any nested scroll area where you want to stop scroll chaining.

01

Scroll Boundaries

Control edge behavior.

02

Three Values

auto to none.

03

Default auto

Browser defaults.

04

Scroll Chaining

Stop parent scroll.

05

Nested Panels

Modals and drawers.

06

Block Axis

Vertical shorthand.

Introduction

The overscroll-behavior property in CSS is used to control the behavior of scroll overflow on a webpage. It defines how the browser handles scrolling when the content reaches the end of a scrollable area.

This property is particularly useful for preventing scroll chaining, where a scroll action in one area can inadvertently scroll other areas.

Definition and Usage

Use overscroll-behavior on elements that scroll independently inside a larger page, such as modal bodies, off-canvas sidebars, dropdown panels, and nested feed lists.

Pair it with overflow: auto or overflow-y: auto so the element actually scrolls. Then set overscroll-behavior: contain to keep edge scrolling inside that box.

💡
Beginner Tip

Create a 150px-tall box with tall content and overflow: auto;. Scroll to the bottom and keep scrolling to feel scroll chaining, then add overscroll-behavior: contain;.

📝 Syntax

The syntax for the overscroll-behavior property is as follows:

syntax.css
element {
  overscroll-behavior: value;
}

It can be applied to any scrollable element. Here, value can be one of the predefined keywords described below.

Basic Example

overscroll-behavior.css
.scroll-container {
  height: 150px;
  overflow: auto;
  overscroll-behavior: contain;
}

Syntax Rules

  • Accepted values: auto, contain, and none.
  • The element must be scrollable, usually with overflow: auto or overflow: scroll.
  • overscroll-behavior is a shorthand for overscroll-behavior-x and overscroll-behavior-y.
  • contain is the most common choice for modals, drawers, and nested panels.

🎯 Default Value

The default value of the overscroll-behavior property is auto, which means the default browser behavior for overscroll will occur.

With auto, scrolling past the 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
Common useModals, sidebars, chat panels, nested scroll lists, mobile drawers

💎 Property Values

ValueExampleDescription
autooverscroll-behavior: auto;The default behavior, where the page scrolls normally and allows scroll chaining.
containoverscroll-behavior: contain;Prevents scroll chaining by containing the scroll action within the element. The element won’t scroll other elements.
noneoverscroll-behavior: none;Disables scroll chaining and overscroll bounce effects. The element and the page won’t respond to overscroll actions.
auto — default contain — stop chaining none — no bounce

👀 Live Preview

Three scroll boxes with the same tall gradient content and different overscroll-behavior values. Scroll each box to its top or bottom edge:

auto
contain
none

Examples Gallery

Prevent scroll chaining with contain, compare default auto behavior, disable bounce with none, and isolate scroll inside a sidebar panel.

🔄 Scroll Containment

Use overscroll-behavior: contain when nested scroll areas should not scroll the page behind them.

Example 1 — Scroll Container with contain

In this example, we’ll apply the overscroll-behavior property to a scrollable div to prevent scroll chaining.

overscroll-contain.html
<style>
  .scroll-container {
    width: 300px;
    height: 150px;
    overflow: auto;
    border: 1px solid #ccc;
    overscroll-behavior: contain;
  }
  .content {
    height: 300px;
    background: linear-gradient(to bottom, #f06, #f9a);
  }
</style>

<div class="scroll-container">
  <div class="content"></div>
</div>
Try It Yourself

How It Works

In this example, the overscroll-behavior: contain; style prevents the parent page from scrolling when the user reaches the top or bottom of the scrollable area.

Example 2 — Default auto Behavior

With overscroll-behavior: auto, the browser keeps its normal overscroll behavior, including scroll chaining where supported.

overscroll-auto.css
.panel {
  max-height: 160px;
  overflow: auto;
  overscroll-behavior: auto;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  padding: 1rem;
}
Try It Yourself

How It Works

When the panel hits its scroll boundary, the browser may pass the scroll gesture to the page behind it.

🚫 Bounce & Nested UI

Disable bounce with none or isolate scroll inside modal and sidebar layouts.

Example 3 — Disable Chaining and Bounce with none

Use overscroll-behavior: none when you want to stop both scroll chaining and overscroll bounce effects.

overscroll-none.css
.feed {
  height: 180px;
  overflow: auto;
  overscroll-behavior: none;
  border: 1px solid #334155;
  border-radius: 0.75rem;
}
Try It Yourself

How It Works

Neither the feed nor the page responds to overscroll actions at the container edges.

Example 4 — Modal or Sidebar Nested Scroll

Keep scroll inside a fixed sidebar or modal body with overscroll-behavior: contain so the page behind stays still.

sidebar-scroll.css
.sidebar-body {
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 1rem;
}
Try It Yourself

How It Works

The sidebar body scrolls independently while edge scrolling does not move the page behind the panel.

overflow vs overscroll-behavior

The overflow properties decide whether content scrolls or gets clipped inside a box. overscroll-behavior decides what happens after that box reaches its scroll boundary.

scroll-companion.css
.modal-body {
  overflow-y: auto;
  overscroll-behavior: contain;
}

♿ Accessibility

  • Do not trap users — Preventing scroll chaining is helpful in overlays, but ensure keyboard users can still exit modals and reach main content.
  • Keep nested scroll areas usable — Pair overscroll control with clear scrollable regions and sufficient contrast.
  • Prefer contain in dialogs — so background page movement does not disorient screen reader users.
  • Test touch devices — Overscroll behavior is especially noticeable on mobile swipe gestures.

🧠 How overscroll-behavior Works

1

User scrolls inside a box

A modal, sidebar, or list scrolls normally while content fits inside its bounds.

Scroll
2

Scroll reaches the edge

The inner container can scroll no farther up, down, left, or right.

Boundary
3

overscroll-behavior is applied

The browser decides whether to chain scroll, bounce, or stop at the container edge.

Value
=

Controlled overscroll

Nested panels stay isolated from the page behind them when you use contain or none.

Browser Compatibility

The overscroll-behavior property is widely supported in modern browsers, including the latest versions of Chrome, Firefox, Edge, and Safari. However, it’s always a good practice to test your website 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 property 95% supported

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

Conclusion

The overscroll-behavior property is a useful tool for controlling scroll behavior on web pages, especially in complex layouts where multiple scrollable areas are present.

By using this property, you can prevent unintended scroll chaining and provide a smoother user experience. Experiment with different values to see how they affect the scrolling behavior on your site.

💡 Best Practices

✅ Do

  • Use overscroll-behavior: contain on modal bodies and sidebars
  • Pair with overflow: auto or overflow-y: auto
  • Test scroll edges on touch devices and trackpads
  • Use none when bounce effects feel distracting
  • Combine with fixed overlays for cleaner nested scroll UX

❌ Don’t

  • Expect overscroll control without a scrollable container
  • Apply none everywhere when contain is enough
  • Confuse overscroll-behavior with overflow
  • Forget keyboard exit paths when locking background scroll
  • Skip cross-browser testing on Safari and mobile Chrome

Key Takeaways

Knowledge Unlocked

Five things to remember about overscroll-behavior

Use these points when nested scroll areas reach their edges.

5
Core concepts
02

Default auto

Browser defaults.

Default
📝 03

Three Values

auto to none.

Values
🚫 04

contain Panels

Stop scroll chaining.

Use case
05

overflow Pair

Scroll then contain.

Companion

❓ Frequently Asked Questions

overscroll-behavior controls what happens when a scrollable element reaches its scroll boundary, such as whether scroll chains to a parent or triggers bounce effects.
The default value is auto, which means the browser uses its normal overscroll behavior, including scroll chaining where supported.
Scroll chaining happens when scrolling past the edge of one scroll area continues scrolling a parent element or the page behind it.
Use contain to keep overscroll inside the element while still allowing local bounce effects. Use none when you want to disable both scroll chaining and overscroll bounce.
Yes. Modern mobile browsers support overscroll-behavior, which is especially useful for modals, drawers, and nested scroll panels on touch devices.

Practice in the Live Editor

Open the HTML editor and experiment with overscroll-behavior: contain, auto, and none on nested scroll 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