Grandma Marni’s price tag tethered to her orange crate: write anchor-name, position-anchor and position-area, drag the crate, and the browser places the tag…
Why it matters
Tooltips, dropdowns, menus and popovers are in every app, and placing them used to need JS (or Popper/Floating UI): measure the button, work out coordinates, redo it on every scroll and resize, plus flip logic. Anchor positioning replaces that with a few lines of CSS.
The key idea
Tied by name, not by where it sits in the DOM
Common mistakes
The popover is there but its position-area is ignored entirely Anchor positioning only works on elements whose position is absolute or fixed. With static or relative, position-area and anchor() are ignored.
The demo runs fine on your laptop, breaks in another browser Support is still new (Chrome/Edge 125+, Safari 26+). Wrap it in @supports (anchor-name: --x) with a fallback position, or use a polyfill.
The popover sticks to the wrong anchor Two elements with the same anchor-name: the last one in the DOM is used. Make names unique (say, from the item id), or limit them with anchor-scope on the component.
Try it in this playground
Pick three different areas The lit cell in the 3×3 grid moves, and the tag goes into it.
Drag the orange crate The tag follows without a single line of JS working out its position.
Set .label to position: static position-area is ignored and the tag falls back into the flow. Anchor positioning is only for absolute/fixed.
Set flip-block, drag the crate to the top edge The top area does not fit, so the browser flips it below. Without a fallback it is only shifted, over the crate.