CSS #unfunfact: You can only divide by numbers in calc(). calc(5px / 1px) is invalid, not 5 as you might expect. w3.org/TR/css-values/#calc-t…
3
21
26
Because division by 0 is bad, but we can't tell if calc(1px/(16px - 1em)) is invalid until late.
2
So a whole class of use cases has been ruled out due to division by 0? Why not just make invalid at computed value time?
1
1
It's planned to do that in the future. Just a lot of added complication (have to track units) for first level of calc().
1
And that concept was introduced by variables, didn't exist when calc was written. 😀
1
Cool, I suspected that might have been the case! Looking forward to values 4 then :)
1
Replying to @LeaVerou @tabatkins
Would be nice to have a draft of that spec. If there'd been a draft, we might have implemented it a few months back...

Sep 14, 2016 · 4:52 AM UTC

1
1
Replying to @davidbaron
You could have created the draft :) @tabatkins
1