CSS overscroll-behavior Property


Example

Turn off scroll chaining for a scrollable <div> element:

#yellowDiv {
  overscroll-behavior: contain;
}
Try it Yourself »

More "Try it Yourself" examples below.


Definition and Usage

The overscroll-behavior property is used to turn off scroll chaining or overscroll affordance on an element when you try to scroll past the scroll boundary.

Scroll chaining is when overscrolling on an element leads to scroll behavior on the parent element. This is default behavior.

Overscroll affordance is a feedback to the user when trying to scroll beyond the scroll boundary. For example, a visual feedback together with a page refresh normally happens on mobile devices when tying to scroll beyond the top of a page.

The overscroll-behavior property is a shorthand for the following properties:

Values for the overscroll-behavior property can be set in different ways:

If the overscroll-behavior property has two values:

  • overscroll-behavior: none contain;
    • x-direction: there is no overscroll-behavior
    • y-direction: there is no scroll chaining, but overscroll affordance is allowed

If the overscroll-behavior property has one value:

  • overscroll-behavior: contain;
    • there is no scroll chaining in x- or y-direction, but overscroll affordance is allowed
Default value: auto
Inherited: no
Animatable: no. Read about animatable
Version: CSS3
JavaScript syntax: object.style.overscrollBehavior="none" Try it

Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Property
overscroll-behavior 63.0 18.0 * 59.0 16.0 50.0

* In Microsoft Edge, the property value 'none' is treated like 'contain', and this is not correct.



CSS Syntax

overscroll-behavior: auto|contain|none|initial|inherit;

Property Values

Value Description
auto Allows scroll chaining and overscroll affordance behavior. This is default
contain Allows overscroll affordance behavior, but not scroll chaining.
none Does not allow overscroll affordance or scroll chaining behavior.
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

More Examples

Two-value syntax

With the overscroll-behavior property value set to 'auto none', scroll chaining and overscroll affordance is allowed in the x-direction, but not in the y-direction:

#pinkDiv {
  overcroll-behavior: auto none;
}
Try it Yourself »

Related Pages

CSS overscroll-behavior-x property: CSS Overscroll-behavior-x property

CSS overscroll-behavior-y property: CSS Overscroll-behavior-y property

CSS scroll-behavior property: CSS Scroll-behavior property

CSS scroll-margin property: CSS Scroll-margin property

CSS scroll-padding property: CSS Scroll-padding property

CSS scroll-snap-align property: CSS Scroll-snap-align property


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.