[csswg-drafts] css expression inheritance

Netmosfera has just created a new issue for https://github.com/w3c/csswg-drafts:

== css expression inheritance ==
Hi w3c people! I have a proposal about `calc()`, `var()` and similar functions.

I'd like to be able to inherit the expression itself rather than the computed-once value they contain.

For example if I write `calc(1em + 20px)` I expect to get the **current font-size** added of 20px, rather than the `font-size` computed at the time of the very first evaluation of the `calc()` expression.
A simple example could be the following:

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


div > p{
    --foo: 100px;
    /* --border: inherit; /* no effect */
    /* --border: var(--border); /* no effect */
    border:var(--border) red solid; /* expecting 95px red solid */
}
```

http://jsfiddle.net/pd3zeg9v/

What do you think? Or maybe this is already possible and I don't know how?
Thank you in advance.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2749 using your GitHub account

Received on Friday, 8 June 2018 13:13:08 UTC