Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Support nested media queries #30

Closed
MoOx opened this issue Sep 19, 2014 · 6 comments
Closed

Support nested media queries #30

MoOx opened this issue Sep 19, 2014 · 6 comments

Comments

@MoOx
Copy link
Owner

MoOx commented Sep 19, 2014

Nested media queries are working on latest Firefox, Chrome & Safari 8, but not on IE.

We should make this work by moving rules into new media queries using and.

http://jsbin.com/kafoxi/1/edit

@lyzadanger
Copy link

You can also nest @supports per the conditional module that covers nesting @media (any combination can be nested): http://dev.w3.org/csswg/css-conditional-3/

http://jsbin.com/xoqeso/2/edit

@idoo
Copy link

idoo commented Apr 4, 2015

yes, i think it's really cool feature

@Semigradsky
Copy link
Collaborator

Silly example (https://jsbin.com/sakuxiz/edit?css,output):

@media screen {
  html {
    background: yellow;  
  }

  @media (max-width: 1100px) {
    html, body {
      background: green
    }
  }  

  body {
    background: red;
  }
}

We can't move media without ruining styles.

@MoOx
Copy link
Owner Author

MoOx commented Aug 6, 2016

What about transforming this to that

html, body { height: 100%; }

@media screen {
  html {
    background: yellow;  
  }
}
@media screen and (max-width: 1100px) {
  html, body {
    background: green
  }
}  
@media screen {
  body {
    background: red;
  }
}

@jonathantneal
Copy link
Collaborator

That markup will work fine in postcss-nesting.

@MoOx
Copy link
Owner Author

MoOx commented May 29, 2018

postcss-cssnext has been deprecated in favor or postcss-preset-env. Read more at https://moox.io/blog/deprecating-cssnext/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants