Created
November 29, 2011 22:09
-
-
Save averyvery/1406790 to your computer and use it in GitHub Desktop.
Retina and non-retina backgrounds with Sass
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 mobile-sprite($selector, $image){ | |
#{$selector} { | |
background-image: image-url('mobilenormal/' + $image); | |
} | |
@media only screen and (-webkit-min-device-pixel-ratio: 2){ | |
#{$selector} { | |
$image_path: 'mobilenormal/' + $image; | |
background-image: image-url('mobileretina/' + $image); | |
background-size: image-width($image_path) image-height($image_path); | |
} | |
} | |
} | |
@include mobile-sprite('.header', 'header.png'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment