Turn off scroll chaining for a scrollable <div> element in the inline direction:
#yellowDiv {
overscroll-behavior-inline: contain;
}
Try it Yourself »
More "Try it Yourself" examples below.
The overscroll-behavior-inline
property is used to turn off scroll chaining or overscroll affordance on an element when you try to scroll past the scroll boundary in the inline direction.
Note: To scroll sideways to trigger overscroll-behavior in the inline direction, you might need to use swipe-gesture on a touchpad or a touchscreen.
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 CSS overscroll-behavior-inline
and overscroll-behavior-block
properties are very similar to CSS properties overscroll-behavior-x
and overscroll-behavior-y
, but the overscroll-behavior-inline
and overscroll-behavior-block
properties are dependent on inline and block directions.
Note: The related CSS property writing-mode
defines inline direction. This affects whether the inline direction is in the x-direction or y-direction and the result of the overscroll-behavior-inline
property. For pages in English, inline direction is left to right and block direction is downward.
Default value: | auto |
---|---|
Inherited: | no |
Animatable: | no. Read about animatable |
Version: | CSS3 |
JavaScript syntax: | object.style.overscrollBehaviorInline="none" Try it |
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
overscroll-behavior-inline | 63.0 | 18.0 | 59.0 | 16.0 | 50.0 |
overscroll-behavior-inline: auto|contain|none|initial|inherit;
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 |
With the writing-mode
property value of a <div> element set to 'vertical-rl', the inline direction is in the y-direction, and so the overscroll-behavior-inline now works in the y-direction instead of the x-direction:
#yellowDiv {
writing-mode: vertical-rl;
overscroll-behavior-inline: contain;
}
Try it Yourself »
CSS overscroll-behavior property: CSS Overscroll-behavior property
CSS overscroll-behavior-block property: CSS Overscroll-behavior-block property
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
CSS writing-mode property: CSS Writing-mode property
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!