Proprietà CSS overscroll-behavior-block

Definizione e uso

overscroll-behavior-block L'attributo viene utilizzato per chiudere la catena di scorrimento (scroll chaining) o la feedback di scorrimento eccessivo (overscroll affordance) sull'elemento quando si tenta di scorrere oltre i limiti di scorrimento del blocco.

The scroll chain refers to the scroll behavior of the parent element when over-scrolling occurs on an element. This is the default behavior.

Over-scroll feedback is the feedback given when the user tries to scroll beyond the scroll boundary. For example, on mobile devices, when trying to scroll beyond the top of the page, there is usually a visual feedback of page refresh.

CSS overscroll-behavior-block and overscroll-behavior-inline property is related to overscroll-behavior-x and overscroll-behavior-y properties are very similar, but overscroll-behavior-block and overscroll-behavior-inline The property depends on the block direction and inline direction.

Note:Related CSS properties writing-mode It defines the block direction. This affects whether the block direction is in the x-direction or y-direction, and overscroll-behavior-block The result of the property. For English pages, the block direction is downward, and the inline direction is from left to right.

Example

Example 1

Disables the scroll chain of the <div> element that is scrollable in the block direction:

#yellowDiv {
  overscroll-behavior-block: contain;
}

Try it yourself

Example 2: Combining the writing-mode property

Sets the <div> element's writing-mode When the property value is set to 'vertical-rl', the block direction becomes the x-axis, so overscroll-behavior-block Now it works on the x-axis instead of the y-axis:

#yellowDiv {
  writing-mode: vertical-rl;
  overscroll-behavior-block: contain;
}

Try it yourself

CSS Syntax

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

Property value

Value Description
auto Allows scroll chain and over-scroll feedback behavior. Default value.
contain Allows over-scroll feedback behavior but does not allow scroll chain.
none Does not allow over-scroll feedback or scroll chain behavior.
initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical details

Default value: auto
Inheritance: No
Animation creation: Not supported. See:Animation-related properties.
Version: CSS3
JavaScript Syntax: object.style.overscrollBehaviorBlock="none"

Browser Support

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

Chrome Edge Firefox Safari Opera
63.0 18.0 59.0 16.0 50.0

Pagine correlate

Riferimento:Proprietà CSS overscroll-behavior

Riferimento:Proprietà CSS overscroll-behavior-inline

Riferimento:Proprietà CSS overscroll-behavior-x

Riferimento:Proprietà CSS overscroll-behavior-y

Riferimento:Proprietà CSS scroll-behavior

Riferimento:Proprietà CSS scroll-margin

Riferimento:Proprietà CSS scroll-padding

Riferimento:Proprietà CSS scroll-snap-align

Riferimento:Proprietà CSS writing-mode