Open
Description
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:
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 - but got 5px red solid */
}
What do you think? Or maybe this is already possible and I don't know how?
Thank you in advance.