W3C home > Mailing lists > Public > public-css-archive@w3.org > June 2018

[csswg-drafts] css expression inheritance

From: Wes via GitHub <sysbot+gh@w3.org>
Date: Fri, 08 Jun 2018 13:13:03 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-330653182-1528463582-sysbot+gh@w3.org>
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

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:31 UTC