Method 1
Mixin here , in order to achieve this with the help of Compass
Method 2
- , "" , , . (, 23 41 , 46 28 ).
- http://spritegen.website-performance.org/ -. , , 25 . " ": 25 50 . sprite.png spritex2.png
css - :
.#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%; }
, (50%) , .