Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Positioning and Stacking

The position-area property

Reference for the CSS position-area property: place an anchored element in a 3x3 grid around its anchor with keywords like top, bottom span-right and center.

The position-area property is the simplest way to use anchor positioning. Imagine a 3 by 3 grid centered on the anchor element: the middle cell is the anchor itself, and the eight surrounding cells are above, below, left, right and in the corners. position-area picks one cell, or a span of cells, as the containing block for the positioned element, which is then aligned inside it.

It needs a default anchor, set with position-anchor or implied (for example by a popover invoker).

CSS
.tooltip {
  position: absolute;
  position-anchor: --help;
  position-area: top;
}

Try it

Choosing a cell around the anchor

Syntax

CSS
position-area: none | <position-area>;

position-area: top;               /* above the anchor, centered */
position-area: bottom span-right; /* below, spanning center and right columns */
position-area: top left;          /* the top-left corner cell */
position-area: span-all;          /* the whole grid */
  • Initial value: none
  • Applies to: absolutely positioned boxes with a default anchor
  • Inherited: no
  • Animatable: no (discrete)
  • Computed value: as specified

Values

Value Description
none No area is selected; the box is positioned normally.
top, bottom The row above or below the anchor. A single keyword is centered along the other axis.
left, right The column to the left or right of the anchor.
center The middle row or column, which overlaps the anchor.
top left, bottom right, ... A corner cell: one vertical keyword and one horizontal keyword.
span-left, span-right, span-top, span-bottom Span the center cell and one neighbor (for example top span-right).
span-all Span all three cells on that axis.
start, end, block-start, inline-end, ... Logical keywords that follow the writing mode.

Usage notes

  • The anchor defines the grid. The grid's outer edges are the positioned element's own containing block, so cells next to the viewport edge may be small or empty.
  • Alignment is automatic. In a chosen cell, the element is aligned toward the anchor (a top box sits against the anchor's top edge). Use margin for a gap.
  • Do not mix with top/left. If you set explicit inset values, they now refer to the chosen area instead of the original containing block; keep them at auto unless you intend that.
  • Use fallbacks. If the cell does not fit, position-try-fallbacks can flip it to the opposite side.
  • Size is separate. position-area changes the available space, not the element's size; width: max-content is typical for tooltips.

Browser support

Part of CSS anchor positioning: Chromium browsers support it from version 125 and Safari from version 26; other browsers are still catching up. Provide a usable fallback layout.