Created
June 9, 2016 02:23
-
-
Save etoxin/2a31822b1ddb3da84b431837d18370be to your computer and use it in GitHub Desktop.
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
<h1 class="test">Responsive: </h1> |
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
// Example use: | |
// @include respond(desktop) { | |
// .example { | |
// color: red; | |
// } | |
// } | |
@mixin respond($breakpoint) { | |
@if $breakpoint == mobile-only { | |
@media screen and (max-width: 768px) and (orientation: portrait) { | |
@content; | |
} | |
} | |
@if $breakpoint == tablet-portrait { | |
@media screen and (min-width: 768px) and (orientation: portrait) { | |
@content; | |
} | |
} | |
@if $breakpoint == tablet-landscape { | |
@media screen and (min-width: 1024px) and (orientation: landscape) { | |
@content; | |
} | |
} | |
@if $breakpoint == desktop { | |
@media screen and (min-width: 1260px) { | |
@content; | |
} | |
} | |
@if $breakpoint == desktop-hd { | |
@media screen and (min-width: 1920px) { | |
@content; | |
} | |
} | |
} | |
// Example Usage | |
.test { | |
&::after { | |
content: 'Mobile' | |
} | |
@include respond('tablet-portrait') { | |
&::after { | |
content: 'tablet-portrait' | |
} | |
} | |
@include respond('tablet-landscape') { | |
&::after { | |
content: 'tablet-landscape' | |
} | |
} | |
@include respond('desktop') { | |
&::after { | |
content: 'desktop' | |
} | |
} | |
@include respond('desktop-hd') { | |
&::after { | |
content: 'desktop-hd' | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment