RE: CSS Hierarchies + @media queries


[L. David Baron:]
> 
> On Wednesday 2012-02-29 15:42 -0800, Chris Eppstein wrote:
> > 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;
> >   }
> > }
> 
> Just because we could have another way to write something doesn't mean we
> should.  We risk turning the language into perl, i.e., into a language
> where there are ten ways to express the same thing and thus nobody can
> read what anybody else writes.
> 
> I think it's a lot of extra work to implement and it doesn't look like it
> adds much value.
> 
I agree with both these points.

Received on Thursday, 1 March 2012 01:02:27 UTC