Last active
February 22, 2022 01:31
-
-
Save jamesflorentino/9047314 to your computer and use it in GitHub Desktop.
Using 2x images as sprite sheet.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* sprite is 500x500 by default */ | |
.sprite { | |
background: url(sprites.png) top left no-repeat; | |
} | |
.sprite.sprite-user { | |
background-position: 0px -100px; | |
} | |
/* Use the @2x sprite (1000x1000) only if the browser is capable of high-res display */ | |
@media only screen and (-webkit-min-device-pixel-ratio: 1.5) { | |
.sprite { | |
background-image: sprites_2x.png; | |
-webkit-background-size: 500px 500px; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment