Last active
October 6, 2016 16:40
-
-
Save brigleb/34b6223e670e1ffe3e3a to your computer and use it in GitHub Desktop.
Helpful SASS breakpoint mixing for media queries
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
// Breakpoint mixins | |
@mixin bp($point) { | |
// assume that the default is 'small' | |
// usage: @include bp(large) { ... } | |
@if $point == medium { // 641px, 1024px | |
@media only screen and (min-width: 40.063em) { @content; } | |
} | |
@else if $point == large { // 1025px, 1440px | |
@media only screen and (min-width: 64.063em) { @content; } | |
} | |
@else if $point == xlarge { // 1441px, 1920px | |
@media only screen and (min-width: 90.063em) { @content; } | |
} | |
@else if $point == xxlarge { // 1921px and up | |
@media only screen and (min-width: 120.063em) { @content; } | |
} | |
@else if $point == retina { | |
@media only screen and (-webkit-min-device-pixel-ratio: 1.5), | |
only screen and (min--moz-device-pixel-ratio: 1.5), | |
only screen and (min-device-pixel-ratio: 1.5) { @content; } | |
} | |
@else if $point == iphone { // an iPhone 5 | |
@media (device-height: 568px) and (-webkit-min-device-pixel-ratio: 2) { @content } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment