Normally, only certain replaced elements have an aspect ratio, particularly images. For them, if only one of width and height is specified, the other can be computed from it using the intrinsic aspect ratio. This property allows explicitly specifying an aspect ratio for any other element to get similar behavior.

Motivation

Generalizes the aspect ratio concept to general elements. This allows various effects, for example sizing <iframe> elements using an aspect ratio, things like filmstrips where each element has the same height but needs an appropriate width, cases where a replaced element is wrapped by a component but should keep the aspect ratio, etc.

Demo

Specification

Specification link


Specification being incubated in a Community Group

Status in Chromium

Blink>Layout


Enabled by default (tracking bug)

Consensus & Standardization

After a feature ships in Chrome, the values listed here are not guaranteed to be up to date.

Owners

Intent to Prototype url

Intent to Prototype thread

Search tags

aspect-ratio, aspect, ratio,

Last updated on 2021-04-26