---
source: https://iinventedlight.com/library/notes/css-anchor-positioning.md
title: "CSS anchor positioning: place one element relative to another"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC-BY-4.0 (web.dev); CC-BY-4.0 (Chrome Developers); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: web.dev, Anchor positioning; Chrome Developers, The CSS anchor positioning API. CC-BY-4.0 (https://web.dev/learn/css/flexbox). Copyright Google LLC. web.dev text is CC BY 4.0. CC-BY-4.0 (https://developers.google.com/site-policies). Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License. Copyright Google LLC."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-23
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-23
as_of: 2026-11-23
confidence: medium
untested: "Not reproduced (2026-11-23). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-web: css-anchor-positioning"
tags: [css, anchor-positioning, layout, tooltip, web]
client: Librarian
sources:
  - id: S1
    title: "Anchor positioning"
    publisher: web.dev
    url: https://web.dev/learn/css/anchor-positioning
    accessed: 2026-11-23
    license: "CC-BY-4.0"
  - id: S2
    title: "The CSS anchor positioning API"
    publisher: Chrome Developers
    url: https://developer.chrome.com/docs/css-ui/anchor-positioning-api
    accessed: 2026-11-23
    license: "CC-BY-4.0"
---
# CSS anchor positioning: place one element relative to another
**Answer:** CSS anchor positioning lets you declaratively place one element relative to another. Name the reference with anchor-name, starting with two dashes, then point at that name with position-anchor.

## Naming an anchor and tethering to it

This CSS feature lets you declaratively position one element relative to another element.

Give the reference an anchor-name. That value is a string that starts with two dashes.

Take the positioned element out of normal flow with position set to absolute or to fixed.

Then set position-anchor to the name you assigned on the reference.

## Anchors in the CSS API

This API lets you position elements relative to other elements, known as anchors.

The reference is designated as a reference point using the anchor-name property.

The unique identifier must be prepended with a double dash, much like a CSS variable.

Because the feature is built into the browser, layered interfaces do not have to rely on third-party libraries.

## See also

- [css-logical-properties](https://iinventedlight.com/library/notes/css-logical-properties/)
- [html-popover](https://iinventedlight.com/library/notes/html-popover/)
- [css-view-transitions](https://iinventedlight.com/library/notes/css-view-transitions/)

## Claims

- id: C1
  claim: The feature declaratively positions one element relative to another.
  source: S1
  evidence: "declaratively position an element relative to another element"

- id: C2
  claim: An anchor-name value is a string that starts with two dashes.
  source: S1
  evidence: "string that starts with two dashes"

- id: C3
  claim: An anchor is designated as a reference point using anchor-name.
  source: S2
  evidence: "designated as a reference point using the anchor-name property"

- id: C4
  claim: The identifier must be prepended with a double dash.
  source: S2
  evidence: "must be prepended with a double dash"

## Sources

- [S1] Anchor positioning. web.dev. https://web.dev/learn/css/anchor-positioning . License: CC-BY-4.0. Accessed 2026-11-23.

- [S2] The CSS anchor positioning API. Chrome Developers. https://developer.chrome.com/docs/css-ui/anchor-positioning-api . License: CC-BY-4.0. Accessed 2026-11-23.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: web.dev, Anchor positioning; Chrome Developers, The CSS anchor positioning API. CC-BY-4.0 (https://web.dev/learn/css/flexbox). Copyright Google LLC. web.dev text is CC BY 4.0. CC-BY-4.0 (https://developers.google.com/site-policies). Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License. Copyright Google LLC. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
