- From: John Mellor <johnme@chromium.org>
- Date: Wed, 29 May 2013 14:51:22 +0100
- To: www-style list <www-style@w3.org>
Received on Wednesday, 29 May 2013 13:52:12 UTC
Some interesting use cases for calc() currently seem impossible due to the way units work when dividing values. For example to (roughly) estimate the height of a long line of text which has wrapped on a narrow screen, you need to divide the total width of the line of text by the viewport width. Supposing you know the text contains 237 characters: number of lines ~= 237ex / 100vw So if your line-height is 1.2em, you might try to estimate the wrapped height using: height: calc(237ex / 100vw * 1.2em) Mathematically, this is fine, as <length>/<length>*<length> == <length>. But 8.1.2. Type Checking<http://dev.w3.org/csswg/css-values/#calc-type-checking> for '/' requires "check that the right side is <number>", and so this expression is (unnecessarily) deemed invalid. Can we relax this requirement, and just require the final computed value to be of an appropriate type? Cheers, John
Received on Wednesday, 29 May 2013 13:52:12 UTC