Re: [media-queries] Using calc()

On Fri, Aug 17, 2012 at 2:26 PM, Thaddee Tyl <> 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.


Received on Friday, 17 August 2012 21:48:15 UTC