Skip to content

Instantly share code, notes, and snippets.

@murokaco
Last active May 13, 2019 05:33
Show Gist options
  • Save murokaco/4a708ce994ad8748784443d6e802a290 to your computer and use it in GitHub Desktop.
Save murokaco/4a708ce994ad8748784443d6e802a290 to your computer and use it in GitHub Desktop.
// --------------------------------------------
// media query
// --------------------------------------------
$breakpoint-sm: 414px !default; /*iPhone XR*/
$breakpoint-md: 768px !default;
$breakpoint-lg: 1000px !default;
$breakpoint-xl: 1240px !default;
$breakpoints: (
sm: 'screen and (max-width: #{$breakpoint-sm})',
md: 'screen and (max-width: #{$breakpoint-md})',
lg: 'screen and (max-width: #{$breakpoint-lg})',
xl: 'screen and (max-width: #{$breakpoint-xl})');
@mixin mq($breakpoint: md) {
@media #{map-get($breakpoints, $breakpoint)} {
@content;
}
}
// --------------------------------------------
// how to use
// --------------------------------------------
.hoge {
@include mq(sm){
display: flex;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment