Re: [csswg-drafts] [css-variables-2] Custom units as simple variable desugaring (#7379)

Thought of another use-case that I would use these for:

1. I like having `rem` as a reference to the user's chosen font-size preference, which means not adjusting the font-size on the root element.
2. I also like having `rem` as a site-specific font size that's determined relative to that default.

I can't have both. The only way to have option 1 is to give up on option 2. At that point I have to use custom props & calc in order to reference a site-specific base font size. That size is often a clamp function combining `rem` and `vi` units, established on the body element to avoid overtaking the `rem`. Using custom units would make this feel much more natural:

```css
body {
  --bem: clamp(1rem, 0.9rem + 1vi, 1.5rem);
  font-size: var(--bem);
}

h1 {
  /* font-size: calc(2 * var(--bem)); */
  font-size: 2--bem;
}

.small {
  font-size: 1rem;
}
```

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


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

Received on Thursday, 15 December 2022 21:05:31 UTC