Re: [mediaqueries] Add "<" and ">" syntax?

On Wed, Nov 13, 2013 at 8:16 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
> On Wed, Nov 13, 2013 at 2:06 PM, Andrew Fedoniouk
> <news@terrainformatica.com> wrote:
>> While we are on this page what about adding support of basic math
>> there - the same set of rules/syntax used by the calc():
>>
>> (width < 800px + 40px)
>> (width < 800px * 2 + 40px)
>> (width < 800px * 3 + 40px)
>>
>> So calc() and media queries will use same expression syntax (reduced
>> in calc case). So UAs can implement this using the same expression
>> evaluation code.
>
> Just use calc():
>
> (width < calc(800px + 40px))
>
> ~TJ

Good one, thanks. But I think calc() should be mentioned explicitly as
currently [1]  contains just this:

4.1. width
Value: <length>

And calc() is not a length strictly speaking. Yes, [2]  contains
statement "It can be used wherever <length>, <frequency>, <angle>,
<time>, <number>, or <integer> values are allowed." but calc() among
other things can be evaluated to <percent> for example. Treatment of
<percent>s in MQ can be different from normal box model that we have
(e.g. calculated against screen workspace dimensions). In fact calc()
may also benefit from having conditionals:
   calc( 20px > 2em ? 300px : 200px )
but that's another story indeed.


[1] http://www.w3.org/TR/css3-mediaqueries/#width
[2] http://www.w3.org/TR/css3-values/#calc-notation

-- 
Andrew Fedoniouk.

http://terrainformatica.com

Received on Friday, 15 November 2013 00:06:27 UTC