Last active
August 29, 2015 14:08
-
-
Save wfendler/68a57a53cf6d7b84605f to your computer and use it in GitHub Desktop.
Divvy media query implementation
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
.box { | |
// base/"mobile" styles | |
} | |
.box--within--hand { | |
@include media-query($BP--WITHIN--HAND) { | |
// |---hand---| styles | |
} | |
} | |
.box--starts-at--hand { | |
@include media-query($BP--STARTS_AT--HAND) { | |
// |---hand---> styles | |
} | |
} | |
.box--ends-at--hand { | |
@include media-query($BP--ENDS_AT--HAND) { | |
// <---hand---| styles | |
} | |
} |
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 media-query ($MQ) { | |
@media only screen and #{$MQ} { | |
@content; | |
} | |
} |
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
$VIEWPORT--HAND_START: 320px; | |
$VIEWPORT--HAND_END: 480px; | |
$VIEWPORT--LAP_START: $VIEWPORT--HAND_END + 1px; | |
$VIEWPORT--LAP_END: 768px; | |
$VIEWPORT--DESK_START: $VIEWPORT--LAP_END + 1px; | |
$VIEWPORT--DESK_END: 1400px; | |
$BP--WITHIN--HAND: "(min-width: #{$VIEWPORT--HAND_START}) and (max-width: #{$VIEWPORT--HAND_END})"; | |
$BP--STARTS_AT--HAND: "(min-width: #{$VIEWPORT--HAND_START})"; | |
$BP--ENDS_AT--HAND: "(max-width: #{$VIEWPORT--HAND_END})"; | |
$BP--WITHIN--LAP: "(min-width: #{$VIEWPORT--LAP_START}) and (max-width: #{$VIEWPORT--LAP_END})"; | |
$BP--STARTS_AT--LAP: "(min-width: #{$VIEWPORT--LAP_START})"; | |
$BP--ENDS_AT--LAP: "(max-width: #{$VIEWPORT--LAP_END})"; | |
$BP--WITHIN--DESK: "(min-width: #{$VIEWPORT--DESK_START}) and (max-width: #{$VIEWPORT--DESK_END})"; | |
$BP--STARTS_AT--DESK: "(min-width: #{$VIEWPORT--DESK_START})"; | |
$BP--ENDS_AT--DESK: "(max-width: #{$VIEWPORT--DESK_END})"; | |
// We could also end up doing stuff like: | |
// $BP--PORTRAIT: (orientation:portrait); | |
// $BP--LANDSCAPE: (orientation:landscape); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment