Created
April 23, 2014 15:36
-
-
Save robertlyall/11220283 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains hidden or 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
| // ---- | |
| // Sass (v3.3.5) | |
| // Compass (v1.0.0.alpha.18) | |
| // ---- | |
| // variables.scss | |
| $screen-xs-max: 767px; | |
| $screen-sm: $screen-xs-max + 1px; | |
| $screen-sm-max: 991px; | |
| $screen-md: $screen-sm-max + 1px; | |
| $screen-md-max: 1199px; | |
| $screen-lg: $screen-md-max + 1px; | |
| // mixins.scss | |
| @mixin media($device, $only: false) { | |
| $mins: ( | |
| phone: -1, | |
| tablet: $screen-sm, | |
| tablet-h: $screen-md, | |
| desktop: $screen-lg | |
| ); | |
| $maxs: ( | |
| phone: $screen-xs-max, | |
| tablet: $screen-sm-max, | |
| tablet-h: $screen-md-max, | |
| desktop: -1 | |
| ); | |
| $min-width: map-get($mins, $device); | |
| $max-width: if($only == true, map-get($maxs, $device), -1); | |
| @if ($max-width == -1) { | |
| @media screen and (min-width: $min-width) { | |
| @content; | |
| } | |
| } | |
| @else if ($min-width == -1) { | |
| @media screen and (max-width: $max-width) { | |
| @content; | |
| } | |
| } | |
| @else { | |
| @media screen and (min-width: $min-width) and (max-width: $max-width) { | |
| @content; | |
| } | |
| } | |
| } | |
| // view or component | |
| .foo { | |
| @include media(tablet, true) { | |
| content: tablet-only; | |
| } | |
| @include media(tablet-h) { | |
| content: tablet-h; | |
| } | |
| } |
This file contains hidden or 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
| @media screen and (min-width: 768px) and (max-width: 991px) { | |
| .foo { | |
| content: tablet-only; | |
| } | |
| } | |
| @media screen and (min-width: 992px) { | |
| .foo { | |
| content: tablet-h; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment