Created
December 23, 2014 03:06
-
-
Save fraserxu/69c611b70a3594ab2fe0 to your computer and use it in GitHub Desktop.
sass responsive layout mixins
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
$tablet-width: 768px; | |
$desktop-width: 1024px; | |
@mixin tablet { | |
@media (max-width: #{$tablet-width - 1px}) { | |
@content; | |
} | |
} | |
@mixin desktop { | |
@media (min-width: #{$tablet-width}) { | |
@content; | |
} | |
} | |
@mixin retina { | |
@media | |
only screen and (-webkit-min-device-pixel-ratio: 2), | |
only screen and (min--moz-device-pixel-ratio: 2), | |
only screen and (-o-min-device-pixel-ratio: 2/1), | |
only screen and (min-device-pixel-ratio: 2), | |
only screen and (min-resolution: 192dpi), | |
only screen and (min-resolution: 2dppx) { | |
@content; | |
} | |
} | |
@mixin print { | |
@media print { | |
@content; | |
} | |
} |
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
.main { | |
@include tablet { | |
background-color: '#ccc' | |
} | |
@include desktop { | |
backgound-color: '#fff' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment