W3C home > Mailing lists > Public > www-style@w3.org > August 2012

Re: [media-queries] Using calc()

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 17 Aug 2012 14:47:27 -0700
Message-ID: <CAAWBYDDcufOsOk9Ue4ggcFPRUheb7z+qNbqWan8uk6My_8oBxw@mail.gmail.com>
To: Thaddee Tyl <thaddee.tyl@gmail.com>
Cc: www-style <www-style@w3.org>
On Fri, Aug 17, 2012 at 2:26 PM, Thaddee Tyl <thaddee.tyl@gmail.com> wrote:
> Is there any reason not to allow the use of calc() in a media query?
> It feels like having the ability to be precise about lengths would be a win.
>
> For instance, if I have an element with a margin of 2cm and a width of
> 100px, I may want to specify:
>
> @media (max-width: calc(4cm + 100px)) { … }
>
> Right now, it is disallowed and implemented nowhere.

Why do you think it's disallowed?  The base grammar of each query is
just the "expr" term from the Core Grammar, which definitely allows
calc() (since it's what's used for all the declarations).

If browsers don't implement, file bugs.  For efficiency, I think
calc() is usually handled specially in implementations, and so has to
be manually made to work in new places.

~TJ
Received on Friday, 17 August 2012 21:48:15 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:58 GMT