Skip to content

Instantly share code, notes, and snippets.

@jeromecoupe
Last active March 26, 2022 20:53
Show Gist options
  • Save jeromecoupe/6506395 to your computer and use it in GitHub Desktop.
Save jeromecoupe/6506395 to your computer and use it in GitHub Desktop.
Easy Media Queries and Breakpoints in SASS
/*------------------------------------
$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