Skip to content

Instantly share code, notes, and snippets.

@DougSisk
Created January 31, 2014 16:55
Show Gist options
  • Save DougSisk/8736171 to your computer and use it in GitHub Desktop.
Save DougSisk/8736171 to your computer and use it in GitHub Desktop.
Saas retina background image mixin
@mixin retina-background($image, $type, $width, $height, $position:0 0, $repeat:no-repeat) {
background-image: url("#{$image}.#{$type}");
background-position: $position;
background-repeat: $repeat;
@media (min--moz-device-pixel-ratio: 1.3),
(-o-min-device-pixel-ratio: 2.6/2),
(-webkit-min-device-pixel-ratio: 1.3),
(min-device-pixel-ratio: 1.3),
(min-resolution: 1.3dppx) {
background-image: url("#{$image}@2x.#{$type}");
background-size: $width $height;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment