Last active
March 26, 2022 20:53
-
-
Save jeromecoupe/6506395 to your computer and use it in GitHub Desktop.
Easy Media Queries and Breakpoints in SASS
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 | |
------------------------------------*/ | |
/* | |
- small: 600px 37.5em | |
- medium: 760px 47.5em | |
- large: 1024px 64em | |
- xlarge: 1260px 78.75em | |
*/ | |
$mq-list: "small" "(min-width:37.5em)", | |
"medium" "(min-width:47.5em)", | |
"large" "(min-width:64em)", | |
"xlarge" "(min-width:78.75em)"; | |
@mixin mq($breakpoint) | |
{ | |
@each $mq in $mq-list | |
{ | |
$mq-name: nth($mq, 1); | |
$mq-param: nth($mq, 2); | |
@if (unquote($breakpoint) == $mq-name) | |
{ | |
@media only screen and #{$mq-param} | |
{ | |
@content; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment