Re: [csswg-drafts] [css-values-4] Bugs in definition of exceptions for font-relative length units (#5228)

> In summary, the rlh unit, when used for the line-height property of a non-root element, uses the computed value of the line-height property of the parent element

No, the spec says "when [...] used [...] on the element they refer to". The `rlh` unit refers to the root element. So if you use it in a non-root element, the condition won't apply, and it will still be relative to the line-height of the root element.

> Firstly, this includes the `rem` unit, leading to the same bug for `rem` as described above for `rlh`.

No, for the same reason.

> Secondly, this mixes font-relative units and line-relative units. For `lh` and `rlh` the `font-size` property should be irrelevant.

It's relevant, because we don't want cycles like

```css
#element {
  font-size: 1lh;
  line-height: 1em;
}
```

In #2115 I initially proposed detecting cycles with a directed dependency graph, and treat things like `font-size: 1lh` normally if there was no cycle. But from the minutes:

> florian: We could have a less blunt approach, but I don't think there's use cases for the more subtile variants.
> myles: I agree we shouldn't be in the business of trying to do a complex dependency analysis.
> RES0LVED: define lh unit resolution to be that of the parent when the lh unit is spec on line-height or font-size

-- 
GitHub Notification of comment by Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5228#issuecomment-645419670 using your GitHub account

Received on Wednesday, 17 June 2020 14:45:34 UTC