Skip to content

Instantly share code, notes, and snippets.

@manfromanotherland
Created April 13, 2015 11:46
Show Gist options
  • Save manfromanotherland/ee43885baf1ece580d5b to your computer and use it in GitHub Desktop.
Save manfromanotherland/ee43885baf1ece580d5b to your computer and use it in GitHub Desktop.
SASS: Manage responsive breakpoints #snippet
// Manage responsive breakpoints
// @require $mobile
// @example
// .element {
// /* default styles */
// @include respond-to(mobile) { /* styles just for mobile */ }
// @include respond-to(desktop) { /* styles just for desktop */ }
// }
@mixin respond-to($media) {
@if $media == mobile {
@media (max-width: $mobile) {
@content;
}
}
@else if $media == desktop {
@media (min-width: $mobile + 1) {
@content;
}
}
}
$mobile: 320px;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment