[csswg-drafts] [css-values] Range restrictions with units are unclear (#7584)

Loirooriol has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-values] Range restrictions with units are unclear ==
https://andreubotella.com/csswg-auto-build/css-values-4/#numeric-ranges

> [`<length [0,100px]>`](https://andreubotella.com/csswg-auto-build/css-values-4/#length-value) indicates a length between `0px` and `100px` (expressed in any unit).

The problem is that, while all lengths have compatible units that can be converted into the canonical px, this may not be possible at parse time. For example,

```
Name: foo
Value: <length [0,100px]>
Initial: ''0px''
```

```css
div {
  foo: 1em;
  font-size: 50px;
}
```

Then `foo: 1em` becomes `50px` which is within the range. But


```css
div {
  foo: 1em;
  font-size: 200px;
}
```

then `foo: 1em` becomes `200px`, outside the range.

So how is `foo: 1em` validated? Is it always allowed and then clamped at computed-value time?

It may just be simpler to say that range restrictions with dimensions require one side to be `0` (with the canonical unit) and the other side to be `∞` or `-∞`.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7584 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 9 August 2022 15:32:55 UTC