overflow-anchor

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

The overflow-anchor CSS property provides a way to opt out of the browser's scroll anchoring behavior, which adjusts scroll position to minimize content shifts.

Scroll anchoring behavior is enabled by default in any browser that supports it. Therefore, changing the value of this property is typically only required if you are experiencing problems with scroll anchoring in a document or part of a document and need to turn the behavior off.

Try it

Syntax

css
/* Keyword values */
overflow-anchor: auto;
overflow-anchor: none;

/* Global values */
overflow-anchor: inherit;
overflow-anchor: initial;
overflow-anchor: revert;
overflow-anchor: revert-layer;
overflow-anchor: unset;

Values

auto

The element becomes a potential anchor when adjusting scroll position.

none

The element won't be selected as a potential anchor.

Formal definition

Initial valueauto
Applies toall elements
Inheritedno
Computed valueas specified
Animation typediscrete

Formal syntax

overflow-anchor = 
auto |
none

Examples

Prevent scroll anchoring

To prevent scroll anchoring in a document, use the overflow-anchor property.

css
* {
  overflow-anchor: none;
}

Specifications

Specification
CSS Scroll Anchoring Module Level 1
# exclusion-api

Browser compatibility

BCD tables only load in the browser

See also