Skip to content

Instantly share code, notes, and snippets.

@jcroft
Created February 6, 2012 21:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcroft/1755160 to your computer and use it in GitHub Desktop.
Save jcroft/1755160 to your computer and use it in GitHub Desktop.
What I really want in Sass: a syntax for doing media queries inside a selector or mixin...
// Typical grid column mixin..
=column($percent)
width: $percent
float: left
// Fancy new pseudo-selector syntax for media queries which would let my
// column from above switch to 100% when the window got narrower than 600px...
&@media only screen and (min-width: 600px)
width: 100%
// Apply the mixin to some elements...
#main-content
+column(70%)
#sidebar
+column(30%)
// Output...
#main-content {
width: 70%;
float: left;
}
#sidebar {
width: 30%;
float: left;
}
@media only screen and (min-width: 600px) {
#main-content {
width: 100%;
}
#sidebar {
width: 100%;
}
}
@jcroft
Copy link
Author

jcroft commented Feb 6, 2012

Doh! Just realized this is actually already possible with Sass. Nevermind!

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