Skip to content

Instantly share code, notes, and snippets.

@krisbulman
Created November 22, 2013 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krisbulman/7605649 to your computer and use it in GitHub Desktop.
Save krisbulman/7605649 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
@import "compass";
// Retina Wrapper
// Wrap anything in a resolution query
//
// Params:
// $background-size - Optional value to set background size
//
@mixin hdpi-wrapper($background-size: FALSE) {
@media only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (min--moz-device-pixel-ratio: 2),
only screen and (-o-min-device-pixel-ratio: 2 / 1),
only screen and (min-device-pixel-ratio: 2),
only screen and (min-resolution: 192dpi),
only screen and (min-resolution: 2dppx) {
@content;
@if $background-size != FALSE {
@include background-size($background-size);
}
}
}
.retina-magic {
background: image-url('test-1360×572.jpg') no-repeat 0 0;
@include hdpi-wrapper(1360px 572px) {
background: image-url('test-2720×1144.jpg') no-repeat 0 0;
}
}
@charset "UTF-8";
.retina-magic {
background: url('/test-1360×572.jpg') no-repeat 0 0;
}
@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2 / 1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) {
.retina-magic {
background: url('/test-2720×1144.jpg') no-repeat 0 0;
-moz-background-size: 1360px 572px;
-o-background-size: 1360px 572px;
-webkit-background-size: 1360px 572px;
background-size: 1360px 572px;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment