Re: [csswg-drafts] [css-values-4] inherit() function: like var() for parent value, for any property (#2864)

Thinking about this a bit more, I think it should be called `parent()` or `parent-var()`, not `inherit()` which implies action, not value.

A few more use cases (in addition to those in https://github.com/w3c/csswg-drafts/issues/2864#issuecomment-761713059 ):

- Ability to use `attr()` from parents on children ([source](https://twitter.com/concreteniche/status/1377064308220125186))
- Revert to grandparent font size, i.e. `font-size: calc(1em * (1em / parent(font-size)))`. Basically any use case where you want to do math with `inherit`.
- Emulating the old `cycle()` that never made it, e.g. `list-style: if(parent(list-style) = 'disc', 'square');` (assuming `if()` gets in)
- Assign CSS variable based on parent e.g. `--nesting-level: calc(parent(--nesting-level) + 1)`
- Using the parent's `background-color` or `accent-color` to create derived colors (e.g. a lighter color for the heading), see also @argyleink's example above



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


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

Received on Wednesday, 31 March 2021 02:36:48 UTC