Created
July 3, 2015 08:22
-
-
Save gideonheilbron/1be0219b5b3b20087a6f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Defining values | |
$small-range: (0em, 40em); /* 0, 640px */ | |
$medium-range: (40.063em, 64em); /* 641px, 1024px */ | |
$large-range: (64.063em, 90em); /* 1025px, 1440px */ | |
$xlarge-range: (90.063em, 120em); /* 1441px, 1920px */ | |
$xxlarge-range: (120.063em); /* 1921px */ | |
// Defining media queries | |
$screen: "only screen" !default; | |
$landscape: "#{$screen} and (orientation: landscape)" !default; | |
$portrait: "#{$screen} and (orientation: portrait)" !default; | |
$small-up: $screen !default; | |
$small-only: "#{$screen} and (max-width: #{upper-bound($small-range)})" !default; | |
$medium-up: "#{$screen} and (min-width:#{lower-bound($medium-range)})" !default; | |
$medium-only: "#{$screen} and (min-width:#{lower-bound($medium-range)}) and (max-width:#{upper-bound($medium-range)})" !default; | |
$large-up: "#{$screen} and (min-width:#{lower-bound($large-range)})" !default; | |
$large-only: "#{$screen} and (min-width:#{lower-bound($large-range)}) and (max-width:#{upper-bound($large-range)})" !default; | |
$xlarge-up: "#{$screen} and (min-width:#{lower-bound($xlarge-range)})" !default; | |
$xlarge-only: "#{$screen} and (min-width:#{lower-bound($xlarge-range)}) and (max-width:#{upper-bound($xlarge-range)})" !default; | |
$xxlarge-up: "#{$screen} and (min-width:#{lower-bound($xxlarge-range)})" !default; | |
$xxlarge-only: "#{$screen} and (min-width:#{lower-bound($xxlarge-range)}) and (max-width:#{upper-bound($xxlarge-range)})" !default; | |
// Usage | |
@media #{$small-up} { ... } | |
@media #{$small-only} { ... } | |
@media #{$medium-up} { ... } | |
@media #{$medium-only} { ... } | |
@media #{$large-up} { ... } | |
@media #{$large-only} { ... } | |
@media #{$xlarge-up} { ... } | |
@media #{$xlarge-only} { ... } | |
@media #{$xxlarge-up} { ... } | |
@media #{$xxlarge-only} { ... } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment