Skip to content
CZECH TH!S Custom websites
EN CS

The Tooltip That Finally Knows Where It Belongs: CSS Anchor Positioning for Designers

Illustration of a tooltip anchored above a button and its position settings in a visual DevTools editor.

You know the scene: your design has a button with an elegant help bubble above it, its little arrow pointing exactly at the icon. It looks like a detail. Then the developer says, "That'll take a while." Today I'll explain why that used to be true – and why it's changing right now.

At the end of October, Google shipped a Chrome DevTools update (Chrome 155 and 156) that adds a visual editor for something called CSS anchor positioning. It sounds technical, but for designers it's one of the most practical changes of the year.

Why a "simple bubble" was so hard

By default, a browser lays out a page like text in a document: elements stack below and beside each other. A tooltip needs the opposite – it has to escape that flow, float above everything else, and still stay glued to one specific button.

For years we solved this with JavaScript. A script measured where the button was on screen, calculated coordinates for the bubble, and recalculated everything whenever the page scrolled, the window resized, or a mobile keyboard popped up. It also had to watch the edges: if the button sits near the right side of the screen, the bubble can't run off-screen – it has to flip to the left. That's why we reached for libraries like Popper or Floating UI. It worked, but it meant more code, more bugs and more time.

What anchor positioning brings

Anchor positioning is a native CSS feature – part of the language we use to style the web. Put simply: I mark the button as an "anchor" and tell the bubble "stay above this anchor." The browser keeps track of the position itself – while scrolling, resizing and on mobile.

Even more useful is position-try. I can give the browser fallbacks: "ideally above the button; if there's no room, go below; if that fails too, go to the right." That's exactly the logic developers used to write by hand.

Combined with the popover attribute (which makes the panel close when you click outside or press Esc), this gives us a foundation for tooltips, dropdowns, context menus and onboarding hints with far less code. It already works in current versions of all major browsers, so we can use it in real projects, not just experiments.

What it means for your design

Three practical tips for designers:

Design plan B, too. Don't send only the one ideal bubble position. Show what it should look like when it flips down or to the side – including where the arrow points. I can now implement that easily, so it's a shame to leave it for me to improvise.

Think about content, not just shape. A one-word bubble behaves differently from one with three lines of text. Specify a maximum width and what happens with long text in Czech, German or English.

Agree on behaviour. Does it open on hover or on click? What about touchscreens, where "hover" doesn't exist? Does it close by itself? These decisions affect accessibility and the final code far more than the colour of the shadow.

Tools that bring us together

The new DevTools editor can display the area around the anchor as a 3 × 3 grid and let you change the bubble's placement with a click. That opens up a nice possibility: we can sit at one screen, open the live site, and try out together where the bubble should sit – without rewriting code by hand.

The same update adds APCA-based contrast suggestions to the colour picker, which judge the readability of light text on dark backgrounds more accurately. If you're working on dark mode, it's worth a look.

Conclusion

Plenty of things that look simple in a design were long complicated in code – and tooltips were a classic example. Thanks to anchor positioning, "that'll take a while" is turning into "we can do that today." The best use of the time saved is to think through behaviour, edge cases and accessibility together. Send me your design with a plan B – and I'll make sure the bubble always hits its mark.

← Back to the blog

[ LET'S BUILD ]

Send your design — get a price and deadline within 24 h.

Figma, XD, Sketch or PDF. No strings attached, no dev-speak, under your brand.