data-type

<ratio> — CSS reference

A ratio describes the relationship of two nonnegative numbers. The denominator defaults to one when omitted. For aspect-ratio the terms represent width and height. A zero numerator or denominator produces a degenerate ratio, not a usable preferred ratio. A preferred aspect ratio influences automatic sizing but cannot override two independently definite dimensions.

Formal Syntax & Structure

css syntaxcss
aspect-ratio: 16 / 9;

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>Numeric dimension lab</title><style>body {margin:0} .sample {height:12px;background:#006050}#a {width:160px;height:auto;aspect-ratio:16 / 9} #b {width:160px;height:auto;aspect-ratio:2} #c {width:160px;height:40px;aspect-ratio:16 / 9}</style><body><div id="a" class="sample"></div><div id="b" class="sample"></div><div id="c" class="sample"></div></body></html>
CSS Reference