demo · v132

Pinning a badge to a fraction of the anchor's width

Before Chrome 132 you could read anchor-size() into width and height only. Now it works inside inset and margin too — so the badge below sits exactly 25% of the anchor's own width past its right edge, no matter how big the anchor grows. Drag the size sliders to see it track.

checking support…
anchor
tracked badge

the badge offset from the anchor's right edge tracks anchor-size(--a width)


  

see also