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

Re: CSS Hierarchies + @media queries

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 29 Feb 2012 16:06:08 -0800
Message-ID: <CAAWBYDCt7-62FBrDHbib_q6yg=S1Hzg5TzOH_mZY1f8zuO8K6A@mail.gmail.com>
To: Daniel Glazman <daniel.glazman@disruptive-innovations.com>
Cc: www-style@w3.org
On Wed, Feb 29, 2012 at 4:00 PM, Daniel Glazman
<daniel.glazman@disruptive-innovations.com> wrote:
> Le 01/03/12 00:42, Chris Eppstein a écrit :
>> I was reading through http://dev.w3.org/csswg/css3-hierarchies/ and
>> noticed that there was no provision for nesting an @media directive
>> inside a hierarchical selector context.
>>
>> In Sass we let @media be nested in any selector and then "bubble" that
>> @media query to the top level.
>>
>> For example:
>>
>> .context {
>> & .module {
>>     float: left;
>>     width: 50%;
>>     @media all and (max-device-width: 500px) {
>>       float: none;
>>       width: auto;
>>     }
>>   }
>> & p {
>>     color: #333;
>>   }
>> }
>
>
> Wow. I understand the request but that would require a serious
> change in the parsing rules of CSS and I am not sure browser
> vendors will accept that one easily. The existing proposal
> is already super interesting but will have a rather huge impact
> on a) the parser b) the CSS OM c) the CSS resolution algo
> d) editing tools. I'm not sure an extra change of that magnitude
> will be welcomed, at least in the level 1 of that spec.

Like a band-aid, though, it's probably better to make all the parsing
changes at once.

~TJ
Received on Thursday, 1 March 2012 00:06:57 GMT

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