Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
The ultimate media query to rule them all ("all" being high DPI/"Retina" screens)
@media (min--moz-device-pixel-ratio: 1.5),
(-o-min-device-pixel-ratio: 3/2),
(-webkit-min-device-pixel-ratio: 1.5),
(min-device-pixel-ratio: 1.5),
(min-resolution: 1.5dppx) {
/* "retina" styles */
}
@mathiasbynens

This comment has been minimized.

Copy link

@mathiasbynens mathiasbynens commented Jun 26, 2012

Don’t forget about the awkwardly named (min--moz-device-pixel-ratio: 1.5) :)

@madrobby

This comment has been minimized.

Copy link
Owner Author

@madrobby madrobby commented Jun 27, 2012

@mathiasbynens Fixed it to use the weird Mozilla variant. Looking good?

@mathiasbynens

This comment has been minimized.

Copy link

@mathiasbynens mathiasbynens commented Jun 27, 2012

Looks good! You may (or may not) want to add -moz-min-device-pixel-ratio: 1.5 back in, in case Mozilla switch to that syntax before going unprefixed.

@iDGS

This comment has been minimized.

Copy link

@iDGS iDGS commented Sep 14, 2013

I recently came across some additional input on this topic by Brett Jankord http://www.brettjankord.com/2012/11/28/cross-browser-retinahigh-resolution-media-queries/ ...and wondered what your thoughts might be?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.