CSS overflow-anchor Property
Description
The overflow-anchor property controls whether an element participates in the browser’s scroll-anchoring behavior — the mechanism browsers use to try to keep the user’s viewport stable when content above or around the current view changes (for example, when images load, ads are inserted, or DOM nodes are prepended). When an element participates as an anchor, the browser can choose it as a reference point and adjust the scroll position to compensate for layout changes so the user doesn’t unexpectedly jump to a different part of the content. This is a layout-level hint rather than a guarantee: the UA uses heuristics to pick anchors and decide when to apply adjustments, so results are best considered as “helpful” rather than strictly deterministic.
Because anchoring applies to scroll containers, it interacts with how and where scrolling happens on the page — in particular the visible box that actually scrolls. That means it is closely related to the behavior of the element’s overflow properties; for example, whether an element creates an overflow context may determine which container’s scroll position is adjusted (overflow). It also respects CSS containment: containment rules that isolate layout or size can prevent anchoring from crossing element boundaries (contain). In short, anchoring decisions are made in the context of the surrounding layout model, not in isolation.
In practice, you use this capability to improve perceived stability for end users or to avoid unwanted automatic adjustments. For instance, for feeds or chat windows where new content is appended or prepended, anchoring can preserve a reader’s place; conversely, on complex, dynamically resized widgets you may prefer to opt an element out of anchoring to prevent the browser from trying to compensate and causing awkward jumps. Consider the interaction with scripted scrolling and smooth scrolling settings when designing UX — automated adjustments can conflict with developer-initiated scrolls or with CSS-driven smooth motions (scroll-behavior) — so test dynamic content changes to make sure the behavior matches user expectations.
When troubleshooting unexpected scroll jumps, reproduce the content changes (for example, loading an image, inserting a node, or toggling visibility) and observe whether the browser is using an anchor inside the scrolling container; adjusting which elements participate can make shifts more predictable. Keep in mind that because anchors are chosen with heuristics and are influenced by layout containment and scroll context, the same page could behave differently under different viewport sizes or content loading sequences, so validate across the conditions your users will encounter.
Definition
- Initial value
- auto
- Applies to
- all elements
- Inherited
- no
- Computed value
- as specified
- Animatable
- yes
- JavaScript syntax
- object.style.overflowAnchor
Syntax
overflow-anchor: auto | none
Values
- autoThe element becomes a potential anchor when adjusting scroll position.
- noneThe element won't be selected as a potential anchor.
Example
Browser Support
The following information will show you the current browser support for the CSS overflow-anchor property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported in some modern browsers, but not all.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
