- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Tue, 15 Apr 2014 09:47:42 -0700
- To: Cameron McCormack <cam@mcc.id.au>
- Cc: www-style list <www-style@w3.org>
On Mon, Apr 14, 2014 at 8:00 PM, Cameron McCormack <cam@mcc.id.au> wrote:
> I saw somebody want to use CSS Variables with media queries, like this:
>
> :root {
> --large: 800px;
> }
>
> @media screen and (max-width: var(--large)) {
> /* rules to implement some responsive design */
> }
>
> That seems like a reasonable thing to want to do. Can we define that
> variables in @media rules are resolved using the computed style of the root
> element?
It's not a reasonable thing to do - there's no custom property to draw
them from, and as Boris points out, no arbitrary choice you make will
work unless you just prevent all custom properties within an @media.
They want custom media queries, which I'm beginning to spec in the MQ
spec now: <http://dev.w3.org/csswg/mediaqueries/#custom-mq>.
~TJ
Received on Tuesday, 15 April 2014 16:48:30 UTC