Skip to content

Instantly share code, notes, and snippets.

@jamesflorentino
Last active February 22, 2022 01:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesflorentino/9047314 to your computer and use it in GitHub Desktop.
Save jamesflorentino/9047314 to your computer and use it in GitHub Desktop.
Using 2x images as sprite sheet.
/* 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