Example

A simple aspect-ratio property example:

Laboratory

description & Usage

The aspect-ratio property gives the user access to specify the width and height of their tags.

Informations

# Description
Default Value auto
Inherited no
Animatable yes
Version CSS3
JavaScript syntax object.style.aspectRatio="16/9"

Browser compatibility and Support

The numbers inserted in the browser fields indicate the version that supports the aspect-ratio property.

# Chrome Edge Firefox Safari Opera
aspect-ratio

Syntax

Values

Values Description
number The second number you enter in your values defines the height.
initial Adds this value to its default property.
inherit It inherits this value from its parent tag.

Related Pages

CSS tutorial: CSS grid layout module

CSS fit object property: CSS fit object property

CSS Object-position property: CSS Object-position property