Re: [csswg-drafts] [css-values] hem: font-relative unit, relative to host element font-size (#7613)

Hm, I believe something like this would work today?

```css
@property --hem {
  syntax: "<length>";
  initial: 1em;
  inherits: true;
}
:host {
  --hem: 1em;
}
.in-the-shadow {
  font-size: calc(2 * var(--hem));
}
```

When the property is registered like this, it'll process its value using standard computed-value rules, so the `1em` will turn into a px length based on the font-size of the element it's set on (the host element, here).

And once [Variables 2's custom units](https://drafts.csswg.org/css-variables-2/#variable-units) are in, it can be used directly as a unit, like `font-size: 2--hem;`.

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


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

Received on Friday, 19 August 2022 18:37:25 UTC