Skip to content

Instantly share code, notes, and snippets.

@jCrip
Created January 29, 2013 16:29
Show Gist options
  • Save jCrip/4665561 to your computer and use it in GitHub Desktop.
Save jCrip/4665561 to your computer and use it in GitHub Desktop.
Retina images mixin for SCSS
@mixin at2x($image_name, $w: auto, $h: auto, $extention: '.png') {
background-image: image-url($image_name + $extention);
$x2img : $image_name + '@2x' + $extention;
@media
all and (-webkit-min-device-pixel-ratio : 1.5),
all and (-o-min-device-pixel-ratio: 3/2),
all and (min--moz-device-pixel-ratio: 1.5),
all and (min-device-pixel-ratio: 1.5) {
background-image: image-url($x2img);
background-size: $w $h;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment