aspect-ratio

Definite width → height

Each box is 130px wide with an auto height taken from its aspect-ratio.

16 / 9
16 / 9
1 / 1
1 / 1
3 / 4
3 / 4

The ratio-derived height is definite, so a percentage-height child resolves against it — the blue bar is height: 60% of the aspect-ratio: 2 box:

Definite height → width

An absolutely-positioned box (height: 64px; aspect-ratio: 3 / 1) takes its width (192px) from the height. A normal-flow block instead fills its container — stretch-fit wins over the ratio.

abspos → 192px wide
normal block fills 320px (not 120px)

Replaced elements

A 2:1 image at width: 130px: a bare <ratio> overrides its natural ratio, auto <ratio> keeps the natural one, and no value uses the natural 2:1.

1 / 1 (square)
auto 1 / 1 (natural)
no ratio (natural 2:1)

Indefinite percentage height

Inside an auto-height parent, height: 50% is indefinite, so the ratio sizes the height (200px wide, aspect-ratio: 4 / 1 → 50px tall) instead of collapsing to auto.

width 200px, ratio 4/1