Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-nesting] nesting @media queries #56

Open
cyberalien opened this issue Apr 2, 2016 · 3 comments · Fixed by w3c/csswg-drafts#5645
Open

[css-nesting] nesting @media queries #56

cyberalien opened this issue Apr 2, 2016 · 3 comments · Fixed by w3c/csswg-drafts#5645

Comments

@cyberalien
Copy link

CSS nesting spec is nice and clean. Good job on spec. However it doesn't cover major part of what makes sass/less so useful: ability to add media queries to current selector.

I suggest to add possibility of nested media queries, like this:

.foo {
  color: red;
  @media (min-width: 20rem) {
    color: blue;
  }
}

that would be equivalent of:

.foo {
  color: red;
}
@media (min-width: 20rem) {
  .foo {
    color: blue;
  }
}

Nesting media queries inside media queries would match both queries:

.foo {
  color: red;
  @media (min-width: 20rem) {
    color: blue;
    @media (max-width: 30rem) {
      color: green;
    }
  }
}

would be equivalent of

.foo {
  color: red;
}
@media (min-width: 20rem) {
  .foo {
    color: blue;
  }
}
@media (min-width: 20rem) and (max-width: 30rem) {
  .foo {
    color: green;
  }
}
@gilbert
Copy link

gilbert commented Jan 7, 2018

Any updates on this?

@exdeniz
Copy link

exdeniz commented Jun 16, 2018

Any progress for add to spec? New polyfill postcss-preset-env use plugin https://github.com/jonathantneal/postcss-nesting and author remove nested media until this is added to the specification.

@brunoais
Copy link

@tabatkins Any reasons why this was not made or accepted?

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

Successfully merging a pull request may close this issue.

4 participants