Skip to content

Instantly share code, notes, and snippets.

@jensgro
Forked from AlexWebLab/style.css
Created May 10, 2023 15:29
Show Gist options
  • Save jensgro/af41ee4b1a005bf0437f24a2c1a0d1ee to your computer and use it in GitHub Desktop.
Save jensgro/af41ee4b1a005bf0437f24a2c1a0d1ee to your computer and use it in GitHub Desktop.
Retina displays CSS background image
.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