{"id":17757,"date":"2012-08-15T20:53:27","date_gmt":"2012-08-16T03:53:27","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=17757"},"modified":"2013-02-14T09:13:25","modified_gmt":"2013-02-14T16:13:25","slug":"retina-display-media-query","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/snippets\/css\/retina-display-media-query\/","title":{"rendered":"Retina Display Media Query"},"content":{"rendered":"

For including high-res graphics, but only for screens that can make use of them. “Retina” being “2x”:<\/p>\n

@media \r\n(-webkit-min-device-pixel-ratio: 2), \r\n(min-resolution: 192dpi) { \r\n    \/* Retina-specific stuff here *\/\r\n}<\/code><\/pre>\n

Or other highish-res:<\/p>\n

\/* 1.25 dpr *\/\r\n@media \r\n(-webkit-min-device-pixel-ratio: 1.25), \r\n(min-resolution: 120dpi){ \r\n    \/* Retina-specific stuff here *\/\r\n}\r\n\r\n\/* 1.3 dpr *\/\r\n@media \r\n(-webkit-min-device-pixel-ratio: 1.3), \r\n(min-resolution: 124.8dpi){ \r\n    \/* Retina-specific stuff here *\/\r\n}\r\n\r\n\/* 1.5 dpr *\/\r\n@media \r\n(-webkit-min-device-pixel-ratio: 1.5), \r\n(min-resolution: 144dpi){ \r\n    \/* Retina-specific stuff here *\/\r\n}<\/code><\/pre>\n

Old Stuff (don’t use, keeping for posterity)<\/h3>\n
@media\r\nonly screen and (-webkit-min-device-pixel-ratio: 2),\r\nonly screen and (   min--moz-device-pixel-ratio: 2),\r\nonly screen and (     -o-min-device-pixel-ratio: 2\/1) { \r\n  \r\n  \/* Retina-specific stuff here *\/\r\n\r\n}<\/code><\/pre>\n

This is more future proof…<\/p>\n

@media\r\nonly screen and (-webkit-min-device-pixel-ratio: 2),\r\nonly screen and (   min--moz-device-pixel-ratio: 2),\r\nonly screen and (     -o-min-device-pixel-ratio: 2\/1),\r\nonly screen and (        min-device-pixel-ratio: 2),\r\nonly screen and (                min-resolution: 192dpi),\r\nonly screen and (                min-resolution: 2dppx) { \r\n  \r\n  \/* Retina-specific stuff here *\/\r\n\r\n}<\/code><\/pre>\n

Notes:<\/p>\n