Recommended Free Tools
CSS anchor-name gives an element a name that another positioned element can use as a reference. Pair it with position-anchor to associate a tooltip, menu, or other floating element with its trigger; then use anchor() or position-area to choose where it appears.
What does anchor-name do?
anchor-name marks an element as an anchor and assigns it a dashed identifier, such as --trigger. A separate positioned element can refer to that identifier. The property’s initial value is none; it can also take one or more comma-separated dashed identifiers. See MDN’s anchor-name reference.
The property establishes the anchor’s name, but does not by itself place another element. In MDN’s description, the model involves an association, a position, and a location: name the anchor, associate the positioned element with it, and specify where that element should go. MDN explains the association and positioning model.
How to anchor a tooltip or dropdown to a button
For a basic example, name the button as the anchor, make the tooltip absolutely positioned, associate it with the button’s name, and use anchor() to position it. This example places the tooltip’s top edge at the anchor’s bottom and its left edge at the anchor’s horizontal center:
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstall#1 Best Overall
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
.trigger {
anchor-name: --trigger;
}
.tooltip {
position: absolute;
position-anchor: --trigger;
top: anchor(bottom);
left: anchor(center);
}
In this pairing, anchor-name belongs on the reference element, while position-anchor and the positioning declarations belong on the element being placed. The positioned element needs position: absolute or position: fixed to use the anchor relationship described here. MDN documents position-anchor.
How anchor-name, position-anchor, and placement features differ
| Feature | Role | Example |
|---|---|---|
anchor-name |
Names the element that serves as the anchor. | anchor-name: --trigger; |
position-anchor |
Associates a positioned element with an anchor name. | position-anchor: --trigger; |
anchor() |
Uses an anchor-relative edge or position in a positioning declaration. | top: anchor(bottom); |
position-area |
Chooses a placement area relative to the anchor. | Use it when an area-based placement is preferable to specifying coordinates with anchor(). |
MDN summarizes the first two properties this way: “The anchor-name and position-anchor properties provide an explicit association.” The same guide covers associating and positioning elements.
Rank #2
What happens when several anchors have the same name?
If multiple elements share an anchor-name, MDN says the positioned element associates with the last matching anchor in source order. Avoid reusing a name unintentionally when a floating element must track a particular trigger. See MDN’s anchor-positioning guide.
Can you use CSS anchor positioning without JavaScript?
Yes, CSS can handle the placement relationship declaratively: name an anchor, associate a positioned element with it, and define the location with anchor-positioning features. web.dev describes anchor positioning as positioning one element relative to another without JavaScript for the placement logic.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsRank #3
- Brand: Wiley
- Set of 2 Volumes
- A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
That does not mean CSS supplies all behavior a tooltip, menu, or popover may need. The technique addresses placement; whether JavaScript is needed to manage interaction state depends on how the interface is implemented.
Is anchor-name supported in current browsers?
MDN labels anchor-name “Baseline 2026” and says it has worked across the latest devices and browser versions since January 2026. MDN also cautions that some parts may vary in older browsers. Check the compatibility information for the browsers your project targets before shipping. See MDN’s support and compatibility information.
Rank #4
How does CSS anchor-name differ from the HTML anchor attribute?
They are not interchangeable approaches. MDN marks the HTML anchor global attribute as non-standard and experimental. For new CSS implementations, use the CSS anchor-positioning properties, including anchor-name and position-anchor, rather than treating that HTML attribute as a standard substitute. MDN’s HTML anchor attribute page.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

