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.

This property is not as yet implemented in browsers, however some browsers are implementing this internally in order to provide the aspect ratio mapping described below.


aspect-ratio: 1 / 1;

/* Global values */
aspect-ratio: inherit;
aspect-ratio: initial;
aspect-ratio: unset;


Replaced elements with an intrinsic aspect ratio use that aspect ratio, otherwise the box has no preferred aspect ratio. Size calculations involving intrinsic aspect ratio always work with the content box dimensions.
The box’s preferred aspect ratio is the specified ratio of width / height. Size calculations involving preferred aspect ratio work with the dimensions of the box specified by box-sizing.

Formal syntax

auto | <ratio>

Mapping width and height to aspect-ratio

Firefox has added an internal aspect-ratio property (in version 69 onwards) that applies to replaced elements and other related elements that accept width and height attributes. This appears in the browser's internal UA stylesheet. Chrome is also shipping this feature


Specification Status Comment
CSS Intrinsic & Extrinsic Sizing Module Level 4
The definition of 'aspect-ratio' in that specification.
Editor's Draft Initial definition
Initial valueauto
Applies toall elements except inline boxes and internal ruby or table boxes
Computed valueas specified
Animation typediscrete
Canonical orderper grammar

Browser compatibility

No compatibility data found. Please contribute data for "" (depth: 1) to the MDN compatibility data repository.

See also