concept

flex-transferred-size-suggestion — CSS reference

A preferred aspect ratio can transfer a definite preferred cross dimension into the main axis after applicable definite cross-axis min/max constraints. This is an input to the automatic minimum, not an unconditional width. Replaced and non-replaced items combine it differently with content size.

Formal Syntax & Structure

css syntaxcss
height: 50px; aspect-ratio: 2 / 1;

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS flexible sizing lab</title><style>body {margin:0} .sample {background:#dcebe9;color:#182e32}#p{display:flex;width:300px;align-items:flex-start;background:#e6eef2} #p>*{box-sizing:content-box;min-width:0;height:30px;background:#128579;color:white} #b{background:#326c9d}#p{width:80px}#a{flex:1 1 0;min-width:auto;height:50px;aspect-ratio:2 / 1}#b{display:none}</style><body><div id="p"><div id="a">A</div><div id="b">B</div></div></body></html>
CSS Reference