Skip to content

Instantly share code, notes, and snippets.

@JordanForeman
Created March 25, 2015 16:17
Show Gist options
  • Select an option

  • Save JordanForeman/ea224533c9c1ed9c9224 to your computer and use it in GitHub Desktop.

Select an option

Save JordanForeman/ea224533c9c1ed9c9224 to your computer and use it in GitHub Desktop.
Sass Media Queries for Progressive Enhancement
/* These numbers are all arbitrary; feel free to tweak them to your liking/needs */
$mobileBreakpoint: 360px;
$tableBreakpoint: 720px;
$desktopBreakpoint: 1080px;
@mixin breakpoint($bp) {
/* Use min-width for a progressive-enhancement approach */
@media screen and (min-width: $bp) { @content }
}
@mixin mobile() { @include breakpoint($mobileBreakpoint); }
@mixin tablet() { @include breakpoint($tabletBreakpoint); }
@mixin desktop() { @include breakpoint($desktopBreakpoint); }
.custom-class {
/* BASE STYLES */
@include breakpoint(123px){/* CUSTOM BREAKPOINT STYLES */}
@include mobile {/* Mobile Styles */}
@include tablet {/* Tablet Styles */}
@include desktop {/* Desktop Styles */}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment