Skip to content

[media-queries][css-sizing] Support <number> (and therefore calc) as a <ratio> #3757

Closed
@AmeliaBR

Description

@AmeliaBR

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions