Re: [csswg-drafts] css expression inheritance (#2749)

Could this potentially be addressed with an extension of the solution proposed in #2864? (cc @LeaVerou)

Here's what I'm thinking, using the same example as OP:

```css
div {
    --foo: 10px;
    --border: calc(var(--foo) - 5px); /* --border must always be `--foo - 5px` */
}


div > p {
    --foo: 100px;
    border: inherit(--border) red solid; /* --border is inherited as `calc(var(--foo) - 5px)`, so it ends up being 95px */
}
```

Or, maybe I'm misunderstanding how `inherit()` is expected to work and it would actually inherit the parent's computed value of `--border`, so `5px`. If that's the case, we could add a keyword or argument to `inherit()` to make it work the desired way, or even a different function (e.g. `inherit-raw(--border)`). This would also solve #9612.

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


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

Received on Monday, 14 October 2024 15:58:24 UTC