Skip to content

Add support for CSS property "aspect-ratio" #287

@MichaIng

Description

@MichaIng

While this does exist (and is supported) as media feature already, browsers started to support it as regular CSS property as well: https://developer.mozilla.org/docs/Web/CSS/aspect-ratio

In Chromium 88 at least it does not needs to be enabled explicitly anymore but works OOTB according to my tests, so MDN web docs (while writing this) is outdated about this point.

With this it is e.g. possible to set both dimensions of an image relative to the parents width, preserving the aspect ratio of the image, even if the resource is not available or has not yet been loaded:

width: 100%
aspect-ratio: 16/9

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions