Skip to content

Instantly share code, notes, and snippets.

@Shoekrates
Created June 8, 2013 13:51
Show Gist options
  • Save Shoekrates/5735244 to your computer and use it in GitHub Desktop.
Save Shoekrates/5735244 to your computer and use it in GitHub Desktop.
SASS Breakpoint Mixin, mobile-first approach
@mixin breakpoint($point, $value: 0) {
@if $point == mobile {
@media (min-width: 320px) { @content; }
}
@else if $point == mobile-horizontal {
@media (min-width: 480px) { @content; }
}
@else if $point == tablet {
@media (min-width: 768px) { @content; }
}
@else if $point == tablet-horizontal {
@media (min-width: 1024px) { @content; }
}
@else if $point == desktop {
@media (min-width: 1280px) { @content; }
}
@else if $point == desktop-wide {
@media (min-width: 1500px) { @content; }
}
@else {
@media ($point: $value) { @content; }
}
}
@mixin between-breakpoints($min, $max) {
@media (min-width: $min) and (max-width: $max) {
@content;
}
}
/** Usage:
@include breakpoint(tablet) {}
@include breakpoint(min-width, 1192px) {}
@include between-breakpoints(0, 1024px) {}
**/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment