Last active
September 11, 2018 13:06
-
-
Save anton-chernianu/c357807939d8acebe69781f60220edd5 to your computer and use it in GitHub Desktop.
SCSS media mixin
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
#sidebar { | |
float: left; | |
width: 300px; | |
@include respond-to(tablet-p) { float: none; } | |
@include respond-to(tablet-l) { float: none; } | |
@include respond-to(mobile-p) { width: 240px; } | |
} |
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
@mixin respond-to($media) { | |
@if $media == tablet-p { | |
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) { @content; } | |
} @else if $media == tablet-l { | |
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) { @content; } | |
} @else if $media == mobile-p { | |
@media (min-width: 320px) and (max-width: 480px) { @content; } | |
} @else if $media == mobile-l { | |
@media (min-width: 481px) and (max-width: 767px) { @content; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment