The new aspect-ratio property in css-sizing-4 re-uses the <ratio> data type defined for the aspect-ratio media query, which currently only excepts rational fractions defined as <integer> / <integer>.
For flexibility, I propose extending the <ratio> type to support:
-
a single <number> value (so that you could specify aspect-ratio: 1.5 instead of aspect-ratio: 3/2)
-
maybe, an arbitrary numerical fraction (aspect-ratio: 3.3/2.2)
-
maybe, a fraction of lengths (aspect-ratio: 1ch/1em)
The "maybes" are because — for the property, if not the media query — they could be replaced with calc() functions if (a) a single number value (the result of the math expression) is accepted as a ratio, and (b) for length fractions, calc division of values with units is actually implemented.
The new
aspect-ratioproperty in css-sizing-4 re-uses the<ratio>data type defined for the aspect-ratio media query, which currently only excepts rational fractions defined as<integer> / <integer>.For flexibility, I propose extending the
<ratio>type to support:a single
<number>value (so that you could specifyaspect-ratio: 1.5instead ofaspect-ratio: 3/2)maybe, an arbitrary numerical fraction (
aspect-ratio: 3.3/2.2)maybe, a fraction of lengths (
aspect-ratio: 1ch/1em)The "maybes" are because — for the property, if not the media query — they could be replaced with
calc()functions if (a) a single number value (the result of the math expression) is accepted as a ratio, and (b) for length fractions, calc division of values with units is actually implemented.