MDN self-hosted library · e01.org

Using anchored container queries

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

css
.tooltip {
  position: absolute;
  position-anchor: --my-anchor;
  position-area: top;
  position-try-fallbacks: flip-block;
  container-type: anchored;
}
css
@container anchored(fallback: flip-block) {
  /* Descendant styles here */
}
html
<div class="anchor">⚓︎</div>

<div class="infobox">Infobox</div>