v131 · css
CSS Anchor Positioning: anchor-scope
The anchor-scope property allows limiting the visibility of anchor names to a given subtree.
concepts
-
anchor-scope
anchor-scope confines anchor-name lookups to a subtree. Stops duplicate anchor names in different lists from colliding.
-
Ancestor-scoped components
The canonical motivating use case: each component wraps its trigger and popover in an ancestor
anchor-scopehost, keeping reused internal anchor names inside that subtree. -
all vs none vs name
Toggle between the three values (
none,all, and a specific dashed-ident) and watch two parallel widgets either collide or stay isolated. -
List-collision badges
Two side-by-side todo lists with per-row tag + badge anchors. The killer case for
anchor-scope— without row scope, duplicate names stack badges on the final tag. -
Menu Anchor Scope
A navigation bar where three trigger buttons all share
anchor-name: --item-anchor.anchor-scopeon each list item ensures every popover submenu opens beneath its own trigger, not the last one. -
Tooltip Grid
A data grid with one info-button per cell — all using the same anchor name.
anchor-scopeon each cell confines resolution so each tooltip appears next to its own button, not the last one in the DOM.
why it shipped
The anchor-scope property allows limiting the visibility of anchor names to a given subtree.