Created
August 20, 2013 21:08
-
-
Save ashblue/6287370 to your computer and use it in GitHub Desktop.
SASS Media Queries done right
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
/** | |
Targets small screen sizes and below, hides CSS from all other sizes | |
@example | |
@include screen-small { | |
#main { | |
width: auto; | |
background: #000; | |
} | |
} | |
*/ | |
@mixin screen-small { | |
@media screen and (max-width: $max-width) { | |
@content; | |
} | |
} | |
/** | |
Custom screen size for small media queries | |
@example | |
@include screen-small(300px) { | |
#main { | |
width: auto; | |
background: #000; | |
} | |
} | |
*/ | |
@mixin screen-small-custom($size) { | |
@media screen and (max-width: $size) { | |
@content; | |
} | |
} | |
// Targets large screens | |
// @see screen-small | |
@mixin screen-large { | |
@media screen and (min-width: $min-width) { | |
@content; | |
} | |
} | |
// Custom large screen sizes | |
// @see screen-small | |
@mixin screen-large-custom($size) { | |
@media screen and (min-width: $size) { | |
@content; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment