-
-
Save jensgro/af41ee4b1a005bf0437f24a2c1a0d1ee to your computer and use it in GitHub Desktop.
Retina displays CSS background image
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
.logo_background { | |
background-image: url('../img/logo@1x.png'); | |
background-position: center center; | |
background-repeat: no-repeat; | |
background-size: 80px 40px; /* size of the logo image @ 1x */ | |
} | |
@media /* only for retina displays */ | |
only screen and (-webkit-min-device-pixel-ratio: 2), | |
only screen and (min--moz-device-pixel-ratio: 2), | |
only screen and (min-device-pixel-ratio: 2), | |
only screen and (-webkit-min-device-pixel-ratio: 2), | |
only screen and (min-resolution: 192dpi), | |
only screen and (min-resolution: 2dppx) { | |
.logo_background { | |
background-image: url('../img/logo@2x.png'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment