Web/CSS/overflow-anchor

From Get docs


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.

Syntax

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

/* Global values */
overflow-anchor: inherit;
overflow-anchor: initial;
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 value auto
Applies to all elements
Inherited no
Computed value as specified
Animation type discrete

Formal syntax

auto | none

Examples

Prevent scroll anchoring

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

* {
  overflow-anchor: none;
}


Specifications

Specification Status Comment
CSS Scroll Anchoring Module Level 1The definition of 'overflow-anchor' in that specification. Editor's Draft Initial definition.

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
overflow-anchor Chrome

Full support 56

Edge

Full support 79

Firefox

Full support 66

IE

No support No

Opera

Full support 43

Safari

No support No

WebView Android

Full support 56

Chrome Android

Full support 56

Firefox Android

No support No

Opera Android

Full support 43

Safari iOS

No support No

Samsung Internet Android

Full support 6.0

Legend

Full support  
Full support
No support  
No support


See also