Skip to content

Instantly share code, notes, and snippets.

@steveebenezer
Created August 13, 2019 06:35
Show Gist options
  • Select an option

  • Save steveebenezer/b5d03aa64e26f3676ec58d086ce35404 to your computer and use it in GitHub Desktop.

Select an option

Save steveebenezer/b5d03aa64e26f3676ec58d086ce35404 to your computer and use it in GitHub Desktop.
Sass responsive media query mixin
// Widths
$lap-start: 720px!default;
$desk-start: 930px!default;
$desk-normal-start: 1024px!default;
$desk-wide-start: 1170px!default;
$palm-end: $lap-start - 1px;
$lap-end: $desk-start - 1px;
@mixin media-query($media-query){
@if $media-query == palm{
@media only screen and (max-width:$palm-end) { @content; }
}
@if $media-query == lap{
@media only screen and (min-width:$lap-start) and (max-width:$lap-end) { @content; }
}
@if $media-query == lap-and-up{
@media only screen and (min-width:$lap-start) { @content; }
}
@if $media-query == portable{
@media only screen and (max-width:$lap-end) { @content; }
}
@if $media-query == desk{
@media only screen and (min-width:$desk-start) { @content; }
}
@if $media-query == desk-wide{
@media only screen and (min-width: $desk-wide-start) { @content; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment