Last active
December 28, 2017 15:13
-
-
Save joaomosantos/cd468ddf5c05528739669dea9dd659ca to your computer and use it in GitHub Desktop.
Sass - Media Query
This file contains 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
$tablet: 768px; | |
@mixin tablet { | |
@media (max-width: #{$tablet}) { | |
@content; | |
} | |
} | |
p { | |
font-size: 18px; | |
@include tablet { | |
font-size: 16px; | |
} | |
} |
This file contains 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
// media-queries.scss (or .sass) | |
// small screen size (sm) | |
@media (min-width: 801px) { | |
@include banner-sm(); | |
} | |
// medium screen size (md) | |
@media (min-width: 992px) { | |
@include banner-md(); | |
} | |
// --- | |
.banner { | |
text-align: center; | |
font-size: 14px; | |
} | |
// called in media-queries.scss | |
@mixin banner-sm() { | |
.banner { | |
font-size: 20px; | |
} | |
} | |
@mixin banner-md() { | |
.banner { | |
text-align: left; | |
font-size: 25px; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment