Re: [csswg-drafts] [css-properties-values-api] Shorthand for custom property declaration (#7523)

@Loirooriol the behavior of `em` is already well-defined in all the contexts where authors will are allowed to use them – even in global contexts like media queries. And authors _often_ use then in media queries with that limitation. So yes, in media queries it would be resolved to the initial value of font-size. In container queries, it would resolve to the container font size. Etc. 

From the author perspective at least, we don't need a universal answer outside the contexts where length values are allowed. `2em` is a valid length, and should be allowed as an initial value, even if it will have different meanings in different contexts. Context-dependence is the whole point of the responsive unit.

But more to the point, and as Tab has mentioned elsewhere: authors won't always want to distinguish in advance between global-only constants and element-only variables. Ideally, we'd want to define a name and initial value (available globally or locally), and then also have the option to override that value on specific elements in the cascade. The distinction could instead be made in how we access those values: using e.g. `env()` to return the globally-constant initial value, and `var()` to access the cascade-dependent value. Both of those should be able to return a `<length>` in `em` units, and then resolve the units where they are valid, with whatever meaning `em` units have in that situation.

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


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

Received on Monday, 21 August 2023 21:09:32 UTC