CSS overscroll-behavior-block Property

The CSS overscroll-behavior-block property controls scroll chaining and overscroll effects along an element's logical block axis.

Unlike overscroll-behavior-y, which always controls the physical vertical axis, overscroll-behavior-block follows the element's writing mode. It is useful for scrollable panels, dialogs, and other components that need consistent scrolling behavior across horizontal and vertical writing systems.

overscroll-behavior-block Syntax

The overscroll-behavior-block property accepts one keyword that determines how overscroll is handled along the logical block axis.

Basic Syntax

selector {
  overscroll-behavior-block: contain;
}

Keyword Values

.panel {
  overscroll-behavior-block: auto;
}
.panel {
  overscroll-behavior-block: contain;
}
.panel {
  overscroll-behavior-block: none;
}

CSS-Wide Keywords

.panel {
  overscroll-behavior-block: initial;
}
.panel {
  overscroll-behavior-block: inherit;
}
.panel {
  overscroll-behavior-block: unset;
}
.panel {
  overscroll-behavior-block: revert;
}
.panel {
  overscroll-behavior-block: revert-layer;
}

The initial value is auto, which allows the browser's normal scroll chaining and overscroll behavior.

Property Values

Value Description
auto Allows normal scroll chaining and overscroll effects along the block axis.
contain Prevents scroll chaining to ancestor scroll containers while allowing local overscroll effects.
none Prevents scroll chaining and suppresses local overscroll effects along the block axis.
initial Resets the property to auto.
inherit Uses the computed value of the parent element.
unset Resets the property to auto because it is not inherited.
revert Reverts the property according to cascade origin rules.
revert-layer Reverts the property according to cascade layer rules.

Property Characteristics

Characteristic Value
Initial value auto
Inherited No
Applies to Scroll containers
Computed value Specified keyword
Animation type Discrete
Logical axis Block axis
Physical equivalent overscroll-behavior-y or overscroll-behavior-x, depending on writing mode
Length values Not accepted
Percentage values Not accepted

Valid Values

.panel {
  overscroll-behavior-block: auto;
}
.panel {
  overscroll-behavior-block: contain;
}
.panel {
  overscroll-behavior-block: none;
}

Invalid Values

.panel {
  overscroll-behavior-block: hidden;
}
.panel {
  overscroll-behavior-block: 20px;
}
.panel {
  overscroll-behavior-block: contain none;
}

The property accepts only one overscroll keyword. Multiple values are supported by the overscroll-behavior shorthand, not this longhand property.

How It Works

When a user scrolls along the block axis, the browser moves the content until it reaches a scroll boundary.

If the user continues scrolling, the browser may transfer the scrolling action to an ancestor scroll container or display a local overscroll effect. The overscroll-behavior-block property controls this behavior.

Default Behavior

.panel {
  max-height: 200px;
  overflow-y: auto;
  overscroll-behavior-block: auto;
}

In horizontal writing mode, the block axis is vertical. When the panel reaches its vertical boundary, additional scrolling may move the surrounding page.

Preventing Scroll Chaining

.panel {
  max-height: 200px;
  overflow-y: auto;
  overscroll-behavior-block: contain;
}

The panel can still scroll normally, but scrolling does not continue into an ancestor scroll container along the block axis.

Suppressing Overscroll Effects

.panel {
  max-height: 200px;
  overflow-y: auto;
  overscroll-behavior-block: none;
}

Scroll chaining and local overscroll effects are suppressed along the block axis.

Important Consideration

The property does not create a scroll container. The element must already establish scrolling behavior for the setting to have an effect.

Understanding the Block Axis

The block axis is the direction in which block-level content progresses. Its physical orientation depends on the element's writing-mode.

Writing Mode Block Axis Physical Equivalent
horizontal-tb Vertical overscroll-behavior-y
vertical-rl Horizontal overscroll-behavior-x
vertical-lr Horizontal overscroll-behavior-x
sideways-rl Horizontal overscroll-behavior-x
sideways-lr Horizontal overscroll-behavior-x

Horizontal Writing

.panel {
  writing-mode: horizontal-tb;
  overscroll-behavior-block: contain;
}

The property controls vertical overscroll behavior.

Vertical Writing

.panel {
  writing-mode: vertical-rl;
  overscroll-behavior-block: contain;
}

The property controls horizontal overscroll behavior because the block axis runs horizontally.

Important Consideration

The block axis is determined by writing mode, not by the direction property alone. Changing text direction between left-to-right and right-to-left does not change the physical orientation of the block axis in horizontal writing mode.

Controlling Scroll Chaining

Scroll chaining occurs when scrolling reaches the boundary of one scroll container and continues into an ancestor scroll container.

Allowing Scroll Chaining

.inner-panel {
  overflow-y: auto;
  overscroll-behavior-block: auto;
}

In horizontal writing mode, continued vertical scrolling may move an ancestor container after the inner panel reaches its boundary.

Preventing Scroll Chaining

.inner-panel {
  overflow-y: auto;
  overscroll-behavior-block: contain;
}

The inner panel remains independently scrollable without transferring additional block-axis scrolling to an ancestor.

Using none

.inner-panel {
  overflow-y: auto;
  overscroll-behavior-block: none;
}

This also prevents scroll chaining while suppressing local overscroll effects.

Common Uses

  • Scrollable dialog content.
  • Sidebars with independent scrolling.
  • Long dropdown menus.
  • Message and notification panels.
  • Interfaces supporting multiple writing modes.

Important Consideration

Preventing scroll chaining does not stop users from scrolling through the content of the affected container.

Controlling Overscroll Effects

Some browsers display effects when users attempt to scroll beyond a scroll container's boundary. These may include elastic bouncing or glow effects.

auto

.panel {
  overscroll-behavior-block: auto;
}

Allows normal scroll chaining and browser overscroll effects along the block axis.

contain

.panel {
  overscroll-behavior-block: contain;
}

Prevents scroll chaining while allowing local overscroll effects.

none

.panel {
  overscroll-behavior-block: none;
}

Prevents scroll chaining and suppresses local overscroll effects.

Browser Differences

Not every browser displays a visible overscroll effect. Behavior varies according to the browser, operating system, and input device.

Important Consideration

The property controls overscroll at scrolling boundaries. It does not disable ordinary scrolling inside the container.

Logical vs. Physical Properties

CSS provides physical and logical properties for controlling overscroll behavior.

Property Controlled Axis
overscroll-behavior-x Physical horizontal axis
overscroll-behavior-y Physical vertical axis
overscroll-behavior-inline Logical inline axis
overscroll-behavior-block Logical block axis

Physical Property

.panel {
  overscroll-behavior-y: contain;
}

This always controls vertical overscroll behavior, regardless of writing mode.

Logical Property

.panel {
  overscroll-behavior-block: contain;
}

This controls vertical overscroll in horizontal writing modes and horizontal overscroll in vertical writing modes.

Using Both Logical Axes

.panel {
  overscroll-behavior-inline: auto;
  overscroll-behavior-block: contain;
}

The inline axis retains normal overscroll behavior while the block axis prevents scroll chaining.

Important Consideration

Use logical properties when scrolling behavior should adapt to writing mode. Use physical properties when the intended axis must remain horizontal or vertical.

Writing Modes

The writing-mode property changes the orientation of the inline and block axes.

Horizontal Writing Mode

.horizontal-panel {
  writing-mode: horizontal-tb;
  max-height: 200px;
  overflow-y: auto;
  overscroll-behavior-block: contain;
}

The block axis is vertical, so the property controls vertical scroll chaining.

Vertical Writing Mode

.vertical-panel {
  writing-mode: vertical-rl;
  max-width: 250px;
  overflow-x: auto;
  overscroll-behavior-block: contain;
}

The block axis is horizontal, so the property controls horizontal scroll chaining.

Writing-Mode-Aware Sizing

.panel {
  max-block-size: 250px;
  overflow-block: auto;
  overscroll-behavior-block: contain;
}

These logical properties adapt the container's size, overflow, and overscroll behavior to the block axis. Check browser compatibility for overflow-block when using this approach.

Important Consideration

Changing the writing mode affects layout and text flow, not just scrolling. Use a writing mode appropriate for the content rather than changing it solely to control overscroll behavior.

overscroll-behavior-block Example

This example compares the auto, contain, and none values in horizontally written scroll containers.

Scroll inside each panel until reaching the bottom, then continue scrolling. The differences affect scroll chaining and any local overscroll effects supported by the browser.

HTML Example

<div class="block-demo">
  <div class="block-item">
    <h3>auto</h3>
    <div class="block-panel block-auto" tabindex="0">
      <p>Item 1</p>
      <p>Item 2</p>
      <p>Item 3</p>
      <p>Item 4</p>
      <p>Item 5</p>
      <p>Item 6</p>
    </div>
  </div>
  <div class="block-item">
    <h3>contain</h3>
    <div class="block-panel block-contain" tabindex="0">
      <p>Item 1</p>
      <p>Item 2</p>
      <p>Item 3</p>
      <p>Item 4</p>
      <p>Item 5</p>
      <p>Item 6</p>
    </div>
  </div>
  <div class="block-item">
    <h3>none</h3>
    <div class="block-panel block-none" tabindex="0">
      <p>Item 1</p>
      <p>Item 2</p>
      <p>Item 3</p>
      <p>Item 4</p>
      <p>Item 5</p>
      <p>Item 6</p>
    </div>
  </div>
</div>

CSS Example

.block-demo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  padding: 20px;
  background-color: #f1f5f9;
}
.block-item h3 {
  margin: 0 0 10px;
  font-size: 16px;
}
.block-panel {
  box-sizing: border-box;
  height: 160px;
  padding: 12px;
  overflow-y: auto;
  border: 2px solid #64748b;
  background-color: #fff;
}
.block-panel p {
  margin: 0 0 12px;
  padding: 8px;
  background-color: #dbeafe;
}
.block-auto {
  overscroll-behavior-block: auto;
}
.block-contain {
  overscroll-behavior-block: contain;
}
.block-none {
  overscroll-behavior-block: none;
}
Browser Result

auto

Item 1

Item 2

Item 3

Item 4

Item 5

Item 6

contain

Item 1

Item 2

Item 3

Item 4

Item 5

Item 6

none

Item 1

Item 2

Item 3

Item 4

Item 5

Item 6

All three panels allow ordinary vertical scrolling. The differences occur when the scroll position reaches a boundary.

Vertical Writing Mode Example

The following example demonstrates how the same logical property controls horizontal overscroll in a vertical writing mode.

<div class="vertical-block-panel" tabindex="0">
  <p>First section of vertical text.</p>
  <p>Second section of vertical text.</p>
  <p>Third section of vertical text.</p>
  <p>Fourth section of vertical text.</p>
  <p>Fifth section of vertical text.</p>
</div>
.vertical-block-panel {
  box-sizing: border-box;
  writing-mode: vertical-rl;
  width: 280px;
  max-width: 100%;
  height: 180px;
  padding: 15px;
  overflow-x: auto;
  overscroll-behavior-block: contain;
  border: 2px solid #64748b;
  background-color: #f8fafc;
}
.vertical-block-panel p {
  margin: 0 0 15px;
  padding: 10px;
  background-color: #dbeafe;
}
Browser Result

First section of vertical text.

Second section of vertical text.

Third section of vertical text.

Fourth section of vertical text.

Fifth section of vertical text.

In vertical-rl writing mode, block progression is horizontal. The overscroll-behavior-block: contain declaration prevents scroll chaining along that horizontal axis.

Accessibility Considerations

Logical overscroll control should preserve access to content while improving scrolling behavior.

Maintain Keyboard Access

Ensure independently scrollable regions can be navigated with a keyboard. A focusable region may be appropriate when keyboard scrolling is otherwise unavailable.

<div class="scroll-panel" tabindex="0" role="region" aria-label="Scrollable content">
  <p>Scrollable information</p>
</div>

Provide Visible Focus Indicators

.scroll-panel:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

Avoid Scroll Traps

Preventing scroll chaining can make nested scrolling feel restrictive. Use containment only when independent scrolling is useful.

Support Different Writing Modes

Test scrolling behavior when content uses vertical writing modes. The physical scrolling direction changes with the logical block axis.

Important Consideration

The property should not prevent users from reaching essential content or controls inside a scrollable region.

Common Mistakes

Assuming the Block Axis Is Always Vertical

The block axis is vertical in horizontal writing modes but horizontal in vertical writing modes.

Applying the Property to a Non-Scroll Container

.box {
  overscroll-behavior-block: contain;
}

This declaration does not create scrolling. The element must already be a scroll container for overscroll control to have an effect.

Confusing Overscroll with Overflow

The overflow properties control clipping and scrolling. The overscroll-behavior properties control what happens when scrolling reaches a boundary.

Using Invalid Values

.box {
  overscroll-behavior-block: hidden;
}

The hidden keyword is not valid. Use auto, contain, or none.

Expecting contain to Suppress Every Effect

The contain value prevents scroll chaining but permits local overscroll effects. Use none to suppress those effects.

Using Physical and Logical Properties Without Checking Order

.panel {
  overscroll-behavior-y: auto;
  overscroll-behavior-block: contain;
}

In horizontal writing mode, both declarations target the vertical axis. The later declaration takes precedence when the declarations have equal cascade priority.

Ignoring Browser Compatibility

Older browsers may not support logical overscroll properties. Consider a physical-property fallback when necessary.

Important Considerations

Keep the following points in mind when using overscroll-behavior-block:

  • The property controls overscroll behavior along the logical block axis.
  • Its initial value is auto.
  • The property is not inherited.
  • It applies to scroll containers.
  • It accepts auto, contain, and none.
  • Only one keyword is permitted.
  • auto allows normal scroll chaining and overscroll effects.
  • contain prevents scroll chaining while allowing local overscroll effects.
  • none prevents scroll chaining and suppresses local overscroll effects.
  • The block axis depends on the element's writing mode.
  • In horizontal writing mode, the block axis is vertical.
  • In vertical writing modes, the block axis is horizontal.
  • The property does not create a scroll container.
  • It does not disable ordinary scrolling within the container.
  • It is the logical counterpart of the physical overscroll properties.
  • Nested scroll containers are a common use case.
  • Browser overscroll effects vary by platform.
  • Scrollable regions should remain keyboard accessible.
  • Physical-property fallbacks may be useful for older browsers.
  • Test scrolling behavior across writing modes and input devices.

Browser Support

The CSS overscroll-behavior-block property has limited availability compared with the physical overscroll-behavior-x and overscroll-behavior-y properties. Support varies across browsers and versions.

For broader compatibility, provide a physical-property fallback before the logical declaration.

Fallback Example

.panel {
  overscroll-behavior-y: contain;
  overscroll-behavior-block: contain;
}

In horizontal writing mode, both declarations control vertical overscroll. Browsers without logical-property support can use the physical fallback.

For vertical writing modes, use the appropriate horizontal fallback instead.

Vertical Writing Fallback

.panel {
  writing-mode: vertical-rl;
  overscroll-behavior-x: contain;
  overscroll-behavior-block: contain;
}

For current compatibility information, visit Can I Use? and search for overscroll-behavior-block.

Specifications

The overscroll-behavior-block property is defined in CSS Overscroll Behavior Module Level 1.

CSS Overscroll Behavior Module Level 1

The specification defines physical and logical overscroll properties, scroll chaining, and overscroll effects.

For additional documentation and examples, consult MDN Web Docs.

MDN Web Docs: overscroll-behavior-block