[css-values-5] inherit() function: like var() for parent value, for any property
[Edit: We've now defined 'inherit()', but only for custom properties. The issue is left open to track the fuller feature.] ------- We've declined numerous author requests to extend `var()` to arbitrary properties, due to the potential for cycles and how expensive cycle detection would be in the general case. However, providing a way to get the **parent** or **inherited** value of any property does not cause cycles and still helps with a ton of use cases. ## Use cases ### Custom property value that depends on parent value Generic `--depth` ([1](https://twitter.com/plinss/status/1350550362168545280), [2](https://twitter.com/kizmarh/status/1350937936804667394)) ```css * { --depth: calc(inherit(--depth, 0) + 1); } ``` See also: https://github.com/w3c/csswg-drafts/issues/1962 ### Font metrics relative to parent - #2690 - #2764 ```css strong { font-weight: clamp(600, 1.2 * inherit(font-weight), 999); } ``` And any other numerical typographic metric that can be specified in CSS, e.g. `font-stretch`, `font-style` (for variable fonts) etc ### Many of the `currentBackgroundColor` use cases https://github.com/w3c/csswg-drafts/issues/5292 While this does not address all use cases (since it would only provide an ancestor background color), it does address quite a few, and offers a workaround for others. ### Matching nested radii https://github.com/w3c/csswg-drafts/issues/7707 | `inherit` | `inherit()` + calc | |--------|--------| | <img width="377" alt="Screen Shot 202
Posted by LeaVerou on Jul 3, 2018, 12:28 AM
Tags
Related issues
- >Beef is already too expensive for most people.
- I gave this a go a couple of years ago.
- I haven't seen any use cases around me, although I'm not that advanced user.
- [BUG] Pro Max 5x Quota Exhausted in 1.5 Hours Despite Moderate Usage
- > Unfortunately it doesn't offer free hosting for hobbyists.
- Still the same HID remapping project from last month (I was hoping to be done by now, but hardware is hard): https://github.co...
Raise real-world problems, find people facing the same issue, and discuss solutions.4,000 issues0 comments
pricing (Software)
>Beef is already too expensive for most people.
I gave this a go a couple of years ago.
I haven't seen any use cases around me, although I'm not that advanced user.
[BUG] Pro Max 5x Quota Exhausted in 1.5 Hours Despite Moderate Usage
> Unfortunately it doesn't offer free hosting for hobbyists.
Still the same HID remapping project from last month (I was hoping to be done by now, but hardware is hard): https://github.co...
This criticism seems like a complete non-sequitur to me.
Bring back the GitHub Copilot in the CLI commands to not break workflows
[css-values-5] inherit() function: like var() for parent value, for any property
[Edit: We've now defined 'inherit()', but only for custom properties. The issue is left open to track the fuller feature.] ------- We've declined numerous author requests to extend `var()` to arbitrary properties, due to the potential for cycles and how expensive cycle detection would be in the general case. However, providing a way to get the **parent** or **inherited** value of any property does not cause cycles and still helps with a ton of use cases. ## Use cases ### Custom property value that depends on parent value Generic `--depth` ([1](https://twitter.com/plinss/status/1350550362168545280), [2](https://twitter.com/kizmarh/status/1350937936804667394)) ```css * { --depth: calc(inherit(--depth, 0) + 1); } ``` See also: https://github.com/w3c/csswg-drafts/issues/1962 ### Font metrics relative to parent - #2690 - #2764 ```css strong { font-weight: clamp(600, 1.2 * inherit(font-weight), 999); } ``` And any other numerical typographic metric that can be specified in CSS, e.g. `font-stretch`, `font-style` (for variable fonts) etc ### Many of the `currentBackgroundColor` use cases https://github.com/w3c/csswg-drafts/issues/5292 While this does not address all use cases (since it would only provide an ancestor background color), it does address quite a few, and offers a workaround for others. ### Matching nested radii https://github.com/w3c/csswg-drafts/issues/7707 | `inherit` | `inherit()` + calc | |--------|--------| | <img width="377" alt="Screen Shot 202
Comments (0)
No comments yet. Start the discussion.