Skip to content

Instantly share code, notes, and snippets.

@jpavon
Last active December 18, 2015 19:29
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jpavon/5833682 to your computer and use it in GitHub Desktop.
Save jpavon/5833682 to your computer and use it in GitHub Desktop.
Element query workaround
@mixin elementquery() {
@media (min-width: 32.5em) { .content & { @content; } }
@media (min-width: 90em) { .aside & { @content; } }
}
.schedule-component {
@include elementquery() {
color: pink;
}
}
// Output:
@media (min-width: 32.5em) {
.content .schedule-component {
color: pink;
}
}
@media (min-width: 90em) {
.aside .schedule-component {
color: pink;
}
}
@micahgodbolt
Copy link

Why would the aside .schedule-component need to be in it's own media query? At lower than 90em does it need to be the full version of the schedule?

@micahgodbolt
Copy link

Now I see what you mean by passing multiple values through. Check out https://gist.github.com/micahgodbolt/5851228

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment