A Pen by Dang Van Thanh on CodePen.
Created
November 28, 2018 12:33
-
-
Save enzienza/b241a05480a210fbf26bc0b4595cf6ef to your computer and use it in GitHub Desktop.
Media Queries Sass 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
@import "compass/css3"; | |
$phone : '(max-width: 480px)'; | |
$tablet-portrait: '(max-width: 767px)'; | |
$tablet-landscape: '(min-width: 768px) and (max-width: 979px)'; | |
$large-desktop: '(min-width: 1200px)'; | |
$non-retina: 'screen and (-webkit-max-device-pixel-ratio: 1)'; | |
$retina: '(min--moz-device-pixel-ratio: 1.5), | |
(-o-min-device-pixel-ratio: 3/2), | |
(-webkit-min-device-pixel-ratio: 1.5), | |
(min-device-pixel-ratio: 1.5), | |
(min-resolution: 144dpi), | |
(min-resolution: 1.5dppx)'; | |
@mixin respond-to($media) { | |
@media only screen and #{$media} { | |
@content; | |
} | |
} | |
body { | |
background-color: rgba(#1abc9c, .5); | |
@include respond-to($phone) { | |
background-color: rgba(#2ecc71, .5); | |
} | |
@include respond-to($tablet-portrait) { | |
background-color: rgba(#3498db, .5); | |
} | |
@include respond-to($tablet-landscape) { | |
background-color: rgba(#9b59b6, .5); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment