If there already isn't one, I would very much appreciate if someone could give some instructions on how to make a retina and non-retina CSS-sprite myself. Preferably using some CSS sprite -generator in the process if possible.
Related to topic: http://miekd.com/articles/using-css-sprites-to-optimize-your-website-for-retina-displays/
Thank you all in advance!
Here's a Mixin to achieve this with Compass
In your css file you can now define something along the rough lines of:
.#spriteA,spriteB{
background-image: url(sprite.png);
width:25px;
height:25px;
}
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
only screen and (min--moz-device-pixel-ratio: 1.5),
only screen and (min-resolution: 240dpi) {
.#spriteA,spriteB{
background-image: url(spriteX2.png);
width:25px;
height:25px;
}
}
.spriteA{ background-position: 0 50%; }
.spriteB{ background-position: -31px 50%; }
This way, the background position ratio (50%) is maintained whether you using the non-retina or retina resolutions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With