W3C home > Mailing lists > Public > www-style@w3.org > November 2013

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

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Thu, 14 Nov 2013 16:05:59 -0800
Message-ID: <CALRQH78u=hbO4K-7tY+wjRfrL5iQ-Qmb2tmW3+f6TWwWcpBsaQ@mail.gmail.com>
Cc: Daniel Glazman <daniel.glazman@disruptive-innovations.com>, "www-style@w3.org" <www-style@w3.org>
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

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:37 UTC