Created
September 26, 2015 03:32
-
-
Save keithchu/ebb0261c3ee00e387f93 to your computer and use it in GitHub Desktop.
Responsive mixin for easy media queries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// define breakpoints | |
$small: #{"screen and (max-width: 479px)"} | |
$medium: #{"screen and (min-width: 480px) and (max-width: 767px)"} | |
$large: #{"screen and (min-width: 768px)"} | |
// define mixin | |
=respond-to($media...) | |
$media-list: null | |
@each $query in $media | |
$media-list: append($media-list, unquote("#{$query}"), comma) | |
@media #{$media-list} | |
@content | |
// profit! | |
.selector | |
+respond-to($small) | |
color: rebeccapurple | |
+respond-to($medium, $large) | |
color: blanchedalmond |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment