CSS Scroll Anchoring Module Level 1
CSS Scroll Anchoring Module Level 1
Editor’s Draft
30 November 2025
More details about this document
This version:
Latest published version:
Previous Versions:
Feedback:
CSSWG Issues Repository
Editors:
Steve Kobes
Google
Tab Atkins-Bittner
Google
Suggest an Edit for this Spec:
GitHub Editor
World Wide Web Consortium
W3C
liability
trademark
and
permissive document license
rules apply.
Abstract
Changes in DOM elements above the visible region of a
scrolling box
can result in the page moving
while the user is in the middle of consuming the content.
This spec proposes a mechanism to mitigate this jarring user experience
by keeping track of the position of an anchor node and adjusting the scroll offset accordingly.
This spec also proposes an API for web developers to opt-out of this behavior.
CSS
is a language for describing the rendering of structured documents
(such as HTML and XML)
on screen, on paper, etc.
Status of this document
This is a public copy of the editors’ draft.
It is provided for discussion only and may change at any moment.
Its publication here does not imply endorsement of its contents by W3C.
Don’t cite this document other than as work in progress.
Please send feedback
by
filing issues in GitHub
(preferred),
including the spec code “css-scroll-anchoring” in the title, like this:
“[css-scroll-anchoring]
…summary of comment…
”.
All issues and comments are
archived
Alternately, feedback can be sent to the (
archived
) public mailing list
www-style@w3.org
This document is governed by the
18 August 2025 W3C Process Document
1.
Introduction
Today, users of the web are often distracted by content moving around
due to changes that occur outside the viewport.
Examples include script inserting an iframe containing an ad,
or non-sized images loading on a slow network.
Historically the browser’s default behavior has been
to preserve the absolute scroll position when such changes occur.
This means that to avoid shifting content,
the webpage can attempt to reserve space on the page
for anything that will load later.
In practice, few websites do this consistently.
Scroll anchoring aims to minimize surprising content shifts.
It does this by adjusting the scroll position
to compensate for the changes outside the viewport.
The
explainer document
gives an informal overview of scroll anchoring.
1.1.
Value Definitions
This specification follows the
CSS property definition conventions
from
[CSS2]
using the
value definition syntax
from
[CSS-VALUES-3]
Value types not defined in this specification are defined in CSS Values & Units
[CSS-VALUES-3]
Combination with other CSS modules may expand the definitions of these value types.
In addition to the property-specific values listed in their definitions,
all properties defined in this specification
also accept the
CSS-wide keywords
as their property value.
For readability they have not been repeated explicitly.
2.
Description
Scroll anchoring attempts to keep the user’s view of the document stable across layout changes.
It works by selecting a DOM node (the
anchor node
whose movement is used to determine adjustments to the scroll position.
However, if the scroll container is currently
snapped
to an element,
(see
[CSS-SCROLL-SNAP-1]
scroll anchoring is limited to adjustments that would be allowed by
re-snapping
2.1.
Anchor Node Selection
Each
scrolling box
aims to select an
anchor node
that is deep in the DOM
and either should be prioritized as an important DOM node or is close to the
block start edge of its
optimal viewing region
Note:
If the user agent does not support the
scroll-padding
property,
the optimal viewing region of the scrolling box is equivalent to its
content area
An anchor node can be any
box
except one for a non-
atomic inline
The anchor node is always a
descendant
of the
scrolling box
In some cases, a scrolling box may not select any anchor node.
An element
is a
viable candidate
for becoming a scroll anchor for a scrolling box
if it meets all of the
following criteria:
is an element that is not a non-
atomic inline
is
partially visible
or
fully visible
in
is a descendant of
is not in an
excluded subtree
None of the ancestors of
up to
are in an
excluded subtree
Some elements are considered to be
anchor priority candidates
for anchor selection:
The
DOM anchor
of the
focused area of the document
, if such an anchor
is text editable (
editable
editing host
mutable
textarea
, or
mutable
input
with a type that allows text entry).
An element containing the current
active match
of the
find-in-page user-agent algorithm. If the match spans multiple elements, then
consider only the first such element.
Note that if the
priority candidate
is a non-
atomic inline
element, then instead consider its nearest ancestor element that is not a
non-atomic inline element as the priority candidate.
The
anchor node selection algorithm
for a scrolling box
is as follows:
If
is associated with an element
whose computed value of the
overflow-anchor
property is
none
then do not select an anchor node for
Otherwise, for each
priority candidate
PC
in order specified,
check if
PC
is a
viable candidate
in
If so, perform the
candidate examination algorithm
for
PC
in
and terminate.
Note:
Since the priority candidate itself is checked to be viable, the
candidate examination algorithm
is guaranteed to select at least the candidate node itself.
Otherwise, for each DOM child
of the element or document associated with
perform the
candidate examination algorithm
for
in
and terminate if it selects an anchor node.
The
candidate examination algorithm
for a candidate DOM node
in a scrolling box
is as follows:
If
is an
excluded subtree
or if
is
fully clipped
in
then do nothing (
and its descendants are skipped).
If
is
fully visible
in
select
as the anchor node.
If N is
partially visible
For each DOM child
of
perform the
candidate examination algorithm
for
in
and terminate if it selects an anchor node.
For each absolutely-positioned element
whose
containing block
is
but whose DOM parent is not
perform the
candidate examination algorithm
for
in
and terminate if it selects an anchor node.
Select
as the anchor node.
(If this step is reached,
no suitable anchor node was found among
’s descendants.)
Note:
Deeper nodes are preferred to minimize the possibility of content changing
inside the anchor node but outside the viewport, which would cause visible
content to shift without triggering any scroll anchoring adjustment.
Conceptually, a new anchor node is computed for every scrolling box
whenever the scroll position of any scrolling box changes.
(As a performance optimization,
the implementation may wait until the anchor node is needed before computing it.)
A DOM node
is an
excluded subtree
if it is an element and any of the following conditions holds:
’s computed value of the
display
property is
none
’s computed value of the
position
property is
fixed
’s computed value of the
position
property is
absolute
and
’s
containing block
is an ancestor of the scrolling box.
’s computed value of the
overflow-anchor
property is
none
A DOM node
is
fully visible
in a scrolling box
if
’s
scroll anchoring bounding rect
is entirely within the
optimal viewing region
of
A DOM node
is
fully clipped
in a scrolling box
if
’s
scroll anchoring bounding rect
is entirely outside the
optimal viewing region
of
A DOM node
is
partially visible
in a scrolling box
if
is neither
fully visible
in
nor
fully clipped
in
The
scroll anchoring bounding rect
of a DOM node
is
’s
scrollable overflow rectangle
2.2.
Scroll Adjustment
If an anchor node was selected,
then when the anchor node moves,
the browser computes the previous offset
y0
, and the current offset
y1
of the block start edge of the anchor node’s
scroll anchoring bounding rect
relative to the block start edge of the scrolling content in the
block flow direction
of the scroller.
It then queues an adjustment to the scroll position of
y1 - y0
in the block flow direction,
to be performed at the end of the
suppression window
The scroll adjustment is a type of
scrolling
as defined by
[CSSOM-VIEW]
and generates
scroll events
in the manner described there.
2.2.1.
Suppression Window
Every movement of an anchor node occurs within a window of time
called the
suppression window
defined as follows:
The suppression window begins at the start of the current iteration of the
HTML Processing Model
event loop,
or at the end of the most recently completed suppression window,
whichever is more recent.
The suppression window ends at the end of the current iteration of the
HTML Processing Model
event loop,
or immediately before the next operation whose result or side effects
would differ as a result of a change in the scroll position
(for example, an invocation of
getBoundingClientRect()
),
whichever comes sooner.
Note:
The suppression window boundaries should be incorporated into the HTML standard once the
scroll anchoring API is stabilized.
More than one anchor node movement may occur within the same suppression window.
At the end of a suppression window,
the user agent performs all scroll adjustments that were queued during the window
and not suppressed by any
suppression trigger
during the window.
2.2.2.
Suppression Triggers
suppression trigger
is an operation
that suppresses the scroll anchoring adjustment for an anchor node movement,
if it occurs within the suppression window for that movement.
These triggers are:
Any change to the computed value of any of the following properties,
on any element in the path from the anchor node to the scrollable element (or document),
inclusive of both:
top
left
right
, or
bottom
margin
or its longhands
padding
or its longhands
width
height
min-width
max-width
min-height
, or
max-height
position
transform
Any change to the computed value of the
position
property
on any element within the scrollable element (or document),
such that the element becomes or stops being absolutely positioned.
Note that this trigger applies regardless of whether the modified element is
on the path from the anchor node to the scrollable element.
The scroll offset of the scrollable element being zero.
Note:
Suppression triggers exist for compatibility with existing web content that has negative
interactions with scroll anchoring due to shifting content in scroll event handlers.
3.
Exclusion API
Scroll anchoring aims to be the default mode of behavior when launched,
so that users benefit from it even on legacy content.
overflow-anchor
can disable scroll anchoring in part or all of a webpage (opt out),
or exclude portions of the DOM from the anchor node selection algorithm.
Name:
overflow-anchor
Value:
auto
none
Initial:
auto
Applies to:
all elements
Inherited:
no
Percentages:
n/a
Computed value:
specified keyword
Canonical order:
per grammar
Animation type:
discrete
Values are defined as follows:
auto
Declares that the element
is potentially eligible to participate in the
anchor node selection algorithm
for any scrolling box created by the element or an ancestor.
none
Declares that the element and its descendants
(that aren’t nested inside of another scrolling element)
are
not
eligible to participate in the
anchor node selection algorithm
for any scrolling box created by the element or an ancestor.
Note:
It is not possible to turn scroll anchoring "back on"
for descendants of a
overflow-anchor: none
element.
However, descendant
scroll containers
automatically "turn it back on"
(for their own scrolling box)
unless they explicitly have
overflow-anchor: none
set on them as well.
Note:
The
overflow-anchor
property was also proposed (with different values)
for
CSS Sticky Scrollbars
which has now been
superseded
Privacy Considerations
This specification,
as it only adjusts how we compute scroll positions,
introduces no new privacy considerations.
Security Considerations
This specification,
as it only adjusts how we compute scroll positions,
introduces no new security considerations.
Changes
Changes Since the Feb 11 2020 Working Draft
Added definitions of
viable candidate
and
priority candidate
Clarified interaction between scroll anchoring and
scroll snapping
Added a step to run
candidate examination algorithm
on viable priority candidates.
Conformance
Document conventions
Conformance requirements are expressed with a combination of
descriptive assertions and RFC 2119 terminology. The key words “MUST”,
“MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”,
“RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this
document are to be interpreted as described in RFC 2119.
However, for readability, these words do not appear in all uppercase
letters in this specification.
All of the text of this specification is normative except sections
explicitly marked as non-normative, examples, and notes.
[RFC2119]
Examples in this specification are introduced with the words “for example”
or are set apart from the normative text with
class="example"
like this:
This is an example of an informative example.
Informative notes begin with the word “Note” and are set apart from the
normative text with
class="note"
, like this:
Note, this is an informative note.
Advisements are normative sections styled to evoke special attention and are
set apart from other normative text with

, like
this:
UAs MUST provide an accessible alternative.
Tests
Tests relating to the content of this specification
may be documented in “Tests” blocks like this one.
Any such block is non-normative.
Conformance classes
Conformance to this specification
is defined for three conformance classes:
style sheet
CSS
style sheet
renderer
UA
that interprets the semantics of a style sheet and renders
documents that use them.
authoring tool
UA
that writes a style sheet.
A style sheet is conformant to this specification
if all of its statements that use syntax defined in this module are valid
according to the generic CSS grammar and the individual grammars of each
feature defined in this module.
A renderer is conformant to this specification
if, in addition to interpreting the style sheet as defined by the
appropriate specifications, it supports all the features defined
by this specification by parsing them correctly
and rendering the document accordingly. However, the inability of a
UA to correctly render a document due to limitations of the device
does not make the UA non-conformant. (For example, a UA is not
required to render color on a monochrome monitor.)
An authoring tool is conformant to this specification
if it writes style sheets that are syntactically correct according to the
generic CSS grammar and the individual grammars of each feature in
this module, and meet all other conformance requirements of style sheets
as described in this module.
Partial implementations
So that authors can exploit the forward-compatible parsing rules to
assign fallback values, CSS renderers
must
treat as invalid (and
ignore
as appropriate
) any at-rules, properties, property values, keywords,
and other syntactic constructs for which they have no usable level of
support. In particular, user agents
must not
selectively
ignore unsupported component values and honor supported values in a single
multi-value property declaration: if any value is considered invalid
(as unsupported values must be), CSS requires that the entire declaration
be ignored.
Implementations of Unstable and Proprietary Features
To avoid clashes with future stable CSS features,
the CSSWG recommends
following best practices
for the implementation of
unstable
features and
proprietary extensions
to CSS.
Non-experimental implementations
Once a specification reaches the Candidate Recommendation stage,
non-experimental implementations are possible, and implementors should
release an unprefixed implementation of any CR-level feature they
can demonstrate to be correctly implemented according to spec.
To establish and maintain the interoperability of CSS across
implementations, the CSS Working Group requests that non-experimental
CSS renderers submit an implementation report (and, if necessary, the
testcases used for that implementation report) to the W3C before
releasing an unprefixed implementation of any CSS features. Testcases
submitted to W3C are subject to review and correction by the CSS
Working Group.
Further information on submitting testcases and implementation reports
can be found from on the CSS Working Group’s website at
Questions should be directed to the
public-css-testsuite@w3.org
mailing list.
Index
Terms defined by this specification
anchor node
, in § 2
anchor node selection algorithm
, in § 2.1
anchor priority candidate
, in § 2.1
auto
, in § 3
candidate examination algorithm
, in § 2.1
excluded subtree
, in § 2.1
fully clipped
, in § 2.1
fully visible
, in § 2.1
none
, in § 3
overflow-anchor
, in § 3
partially visible
, in § 2.1
priority candidate
, in § 2.1
scroll anchoring bounding rect
, in § 2.1
suppression trigger
, in § 2.2.2
suppression window
, in § 2.2.1
viable candidate
, in § 2.1
Terms defined by reference
[CSS-BOX-4]
defines the following terms:
content area
margin
padding
[CSS-DISPLAY-4]
defines the following terms:
atomic inline
box
containing block
display
none
[CSS-OVERFLOW-3]
defines the following terms:
scroll container
scrollable overflow rectangle
[CSS-POSITION-3]
defines the following terms:
absolute
bottom
fixed
left
position
right
top
[CSS-SCROLL-SNAP-1]
defines the following terms:
optimal viewing region
re-snap
scroll snap
scroll-padding
[CSS-SIZING-3]
defines the following terms:
height
max-height
max-width
min-height
min-width
width
[CSS-TRANSFORMS-1]
defines the following terms:
transform
[CSS-VALUES-4]
defines the following terms:
CSS-wide keywords
[CSS-WRITING-MODES-4]
defines the following terms:
block flow direction
[CSSOM-VIEW]
defines the following terms:
getBoundingClientRect()
scroll
scrolling box
[DOM]
defines the following terms:
descendant
[HTML]
defines the following terms:
active match
DOM anchor
editable
editing host
focused area of the document
input
mutable
textarea
References
Normative References
[CSS-BOX-4]
Elika Etemad.
CSS Box Model Module Level 4
. URL:
[CSS-DISPLAY-4]
Elika Etemad; Tab Atkins Jr..
CSS Display Module Level 4
. URL:
[CSS-OVERFLOW-3]
Elika Etemad; Florian Rivoal.
CSS Overflow Module Level 3
. URL:
[CSS-POSITION-3]
Elika Etemad; Tab Atkins Jr..
CSS Positioned Layout Module Level 3
. URL:
[CSS-SCROLL-SNAP-1]
Matt Rakow; et al.
CSS Scroll Snap Module Level 1
. URL:
[CSS-SIZING-3]
Tab Atkins Jr.; Elika Etemad.
CSS Box Sizing Module Level 3
. URL:
[CSS-TRANSFORMS-1]
Simon Fraser; et al.
CSS Transforms Module Level 1
. URL:
[CSS-VALUES-3]
Tab Atkins Jr.; Elika Etemad.
CSS Values and Units Module Level 3
. URL:
[CSS-VALUES-4]
Tab Atkins Jr.; Elika Etemad.
CSS Values and Units Module Level 4
. URL:
[CSS-WRITING-MODES-4]
Elika Etemad; Koji Ishii.
CSS Writing Modes Level 4
. URL:
[CSS2]
Bert Bos; et al.
Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification
. URL:
[CSSOM-VIEW]
Simon Fraser; Emilio Cobos Álvarez.
CSSOM View Module
. URL:
[DOM]
Anne van Kesteren.
DOM Standard
. Living Standard. URL:
[HTML]
Anne van Kesteren; et al.
HTML Standard
. Living Standard. URL:
[RFC2119]
S. Bradner.
Key words for use in RFCs to Indicate Requirement Levels
. March 1997. Best Current Practice. URL:
Property Index
Name
Value
Initial
Applies to
Inh.
%ages
Anim­ation type
Canonical order
Com­puted value
overflow-anchor
auto | none
auto
all elements
no
n/a
discrete
per grammar
specified keyword
MDN
overflow-anchor
Firefox
66+
Safari
None
Chrome
56+
Opera
Edge
79+
Edge (Legacy)
IE
None
Firefox for Android
iOS Safari
Chrome for Android
Android WebView
Samsung Internet
Opera Mobile