Skip to content

Instantly share code, notes, and snippets.

@nickawalsh
Created August 24, 2012 11:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickawalsh/3449243 to your computer and use it in GitHub Desktop.
Save nickawalsh/3449243 to your computer and use it in GitHub Desktop.
Respond-to
=respond-to($val, $query: min-width, $media: screen)
@media #{$media} and ($query: $val)
@content
// ----- Sample Usage ----- //
p
+respond-to(700px)
width: 700px
+respond-to(500px, max-width)
width: 500px
+respond-to(800px, max-width, print)
width: 800px
/* ----- Sample Compile ----- */
@media screen and (min-width: 700px) {
p {
width: 700px;
}
}
@media screen and (max-width: 500px) {
p {
width: 500px;
}
}
@media print and (max-width: 800px) {
p {
width: 800px;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment