Skip to content

Instantly share code, notes, and snippets.

@bavington
Created November 20, 2013 19:57
Show Gist options
  • Save bavington/7569953 to your computer and use it in GitHub Desktop.
Save bavington/7569953 to your computer and use it in GitHub Desktop.
Retina Detection Media Query for working with Retina Background Images.
div.logo {
margin:0 auto;
border:1px solid #666;
width:400px;
height:215px;
background:url(james-n-nick.jpg) no-repeat;
}
@media only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (-webkit-min-device-pixel-ratio: 1.5),
only screen and (-moz-min-device-pixel-ratio: 2),
only screen and (-o-min-device-pixel-ratio: 3/2),
only screen and (-o-min-device-pixel-ratio: 2/1),
only screen and (min--moz-device-pixel-ratio: 1.5),
only screen and (min-device-pixel-ratio: 1.5),
only screen and (min-device-pixel-ratio: 2) {
/* Add your Retina Image Replacement Classes here. */
div.logo {
background:url([email protected]) no-repeat;
background-size: 400px;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment