anchor-name
Newly availableSince 202687% of users
Defines a unique name for an element so it can be used as an anchor for other positioned elements. This creates the relationship needed for anchor positioning to work.
What's modern
From web-features, MDN's browser data and our snippets, checked dailyModernIn every major browser since January 2026. Widely available around July 2028.
The old way and the modern waySee the snippet: Dropdown width that matches its button →
Old way 8 lines
.select-menu {
position: absolute;
min-width: var(--button-width);
}
/* JS: measure the button and write its width */
const w = button.getBoundingClientRect().width;
menu.style.setProperty('--button-width', w + 'px');
/* then a ResizeObserver to redo it when the label or font changes */Modern 10 lines
.select-button {
anchor-name: --select;
}
.select-menu {
position: absolute;
position-anchor: --select;
position-area: bottom span-right;
min-width: anchor-size(width);
}
/* as wide as the button, no measuring */See how modern your own CSS is.Check your CSS →
Quick facts
- Initial value
none- Inherited
- No
- Applies to
- all elements that generate a principal box
- Animation type
- discrete
Quick example
.button-target {
anchor-name: --my-tooltip-anchor;
}
.tooltip {
position: absolute;
position-anchor: --my-tooltip-anchor;
}Values
noneanchor-name browser support
BaselineNewly availableSince 2026 this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.Works in all modern browsers. May need a fallback for older browsers.
Usage87%of people can use this13% use a browser without it.
Browsers
125+
147+
26+
125+Mobile
125+Android
147+Android
26+iOS
Interop 2026 focus area. All major browsers are actively working to fix cross-browser inconsistencies for this feature in 2026. Learn more →