Anchor Positioning

Not Recommended Updated: Apr 2, 2026

Positions elements relative to anchor elements anywhere on the page, independent of containing block layout.

Baseline:
Limited
Functional:
Progressing
Usage:
Cross-Context

Anchor positioning is spec'd to work within shadow DOM contexts; anchors can be named and positioned within the same shadow tree. Cross-shadow anchoring (referencing an anchor from a different shadow tree) presently has mixed browser support. The anchor-scope property for controlling anchor visibility across shadow boundaries shows similar browser inconsistencies.

Not recommended due to limited browser support, and specificially shadow DOM feature failures. Adoption likely should wait for fully Baseline cross-browser support. Strongly recommend a fallback strategy using positioning libraries like Floating UI.

Web Platform Tests for

Chrome 148: Passes
Edge 148: Passes
Firefox 150: Passes
Safari 26.5: Passes
WPT sources: anchor-name-cross-shadow, anchor-name-in-shadow, anchor-name-in-shadow-002, anchor-scope-shadow-all, anchor-scope-shadow-flat-tree, anchor-scope-shadow-names, at-position-try-invalidation-shadow-dom