The aspect-ratio
CSS property sets a preferred aspect-ratio for the box, which will be used in the calculation of auto sizes and some other layout functions.
<ratio>
The box's preferred aspect-ratio is the ratio of width
to height
. If the height and preceding slash are omitted, height defaults to 1. Size calculations involving aspect-ratio use the dimensions of the box specified by box-sizing
.
:::info
The <ratio>
CSS data type represents a ratio between two numbers. It consists of:
<number>
value<number>
value<number>
is allowed as a value
:::Initial value | has no preferred aspect ratio |
Applies to | all elements |
Inherited | no |
Animatable |
auto
is not supported, one has no preferred aspect-ratio
by default.LCD tables only load in the browser