Skip to content

Instantly share code, notes, and snippets.

@samcus
Last active April 9, 2018 10:04
Show Gist options
  • Save samcus/f81230ca558c74e968737f8f3560a713 to your computer and use it in GitHub Desktop.
Save samcus/f81230ca558c74e968737f8f3560a713 to your computer and use it in GitHub Desktop.
// Define Breakpoints
$mobile: 480px;
$tablet: 960px;
$desktop: 1280px;
@mixin respond-to($media) {
@if $media == small-mobile {
@media (max-width: $mobile) { @content; }
}
@else if $media == mobile {
@media (min-width: $mobile ) { @content; }
}
@else if $media == tablet {
@media (min-width: $tablet ){ @content; }
}
@else if $media == desktop {
@media (min-width: $desktop) { @content; }
}
}
/* Example Usage
body{
background: white;
@include respond-to(mobile){
background: red;
} @include respond-to(tablet){
background: green;
} @include respond-to(desktop){
background: blue;
}
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment