Last active
December 29, 2023 05:33
-
-
Save ralexandr/76f4e2aa6ba7b0209fc4dc3dac0db050 to your computer and use it in GitHub Desktop.
SASS: Media queries + breakpoints
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
// Usage: | |
// .site-header { | |
// padding: 2rem; | |
// font-size: 1.8rem; | |
// @include mq('tablet-wide') { | |
// padding-top: 4rem; | |
// font-size: 2.4rem; | |
// } | |
// } | |
$breakpoints: ( | |
"phone": 400px, | |
"phone-wide": 480px, | |
"phablet": 560px, | |
"tablet-small": 640px, | |
"tablet": 768px, | |
"tablet-wide": 1024px, | |
"desktop": 1248px, | |
"desktop-wide": 1440px | |
); | |
@mixin mq($width, $type: min) { | |
@if map_has_key($breakpoints, $width) { | |
$width: map_get($breakpoints, $width); | |
@if $type == max { | |
$width: $width - 1px; | |
} | |
@media only screen and (#{$type}-width: $width) { | |
@content; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how to writing @content