Last active
December 17, 2015 22:19
-
-
Save yourpalsonja/5681522 to your computer and use it in GitHub Desktop.
SASS Retina Background 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
// retina background mixin with compass | |
@mixin pretty-image($image, $retina-image) { | |
background-image: url($image); | |
@media (-webkit-min-device-pixel-ratio: 1.5), | |
(min-resolution: 1.5dppx) { | |
background-image: url($retina-image); | |
background-size: image-width($image) image-height($image); | |
} | |
} | |
// retina background mixin w/o compass | |
@mixin pretty-image($image, $image-size, $image-width, $retina-image) { | |
background-image: url($image); | |
@media (-webkit-min-device-pixel-ratio: 1.5), | |
(min-resolution: 1.5dppx) { | |
background-image: url($retina-image); | |
background-size: $image-width $image-height; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment