spec on resolution units<\/a>.<\/li>\n<\/ul>\nExample:<\/p>\n
Let’s say you had three major breakpoints in a design. This design also had a large background graphic and you wanted it looking it’s best on any screen (retina or not) and not waste any bandwidth. You’d set up 6 media queries, one for each breakpoint and one for each one of those breakpoints on retina. Then you’d override the background image all the way down.<\/p>\n
@media only screen and (min-width: 320px) {\r\n\r\n \/* Small screen, non-retina *\/\r\n\r\n}\r\n\r\n@media\r\nonly screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 320px),\r\nonly screen and ( min--moz-device-pixel-ratio: 2) and (min-width: 320px),\r\nonly screen and ( -o-min-device-pixel-ratio: 2\/1) and (min-width: 320px),\r\nonly screen and ( min-device-pixel-ratio: 2) and (min-width: 320px),\r\nonly screen and ( min-resolution: 192dpi) and (min-width: 320px),\r\nonly screen and ( min-resolution: 2dppx) and (min-width: 320px) { \r\n\r\n \/* Small screen, retina, stuff to override above media query *\/\r\n\r\n}\r\n\r\n@media only screen and (min-width: 700px) {\r\n\r\n \/* Medium screen, non-retina *\/\r\n\r\n}\r\n\r\n@media\r\nonly screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 700px),\r\nonly screen and ( min--moz-device-pixel-ratio: 2) and (min-width: 700px),\r\nonly screen and ( -o-min-device-pixel-ratio: 2\/1) and (min-width: 700px),\r\nonly screen and ( min-device-pixel-ratio: 2) and (min-width: 700px),\r\nonly screen and ( min-resolution: 192dpi) and (min-width: 700px),\r\nonly screen and ( min-resolution: 2dppx) and (min-width: 700px) { \r\n\r\n \/* Medium screen, retina, stuff to override above media query *\/\r\n\r\n}\r\n\r\n@media only screen and (min-width: 1300px) {\r\n\r\n \/* Large screen, non-retina *\/\r\n\r\n}\r\n\r\n@media\r\nonly screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 1300px),\r\nonly screen and ( min--moz-device-pixel-ratio: 2) and (min-width: 1300px),\r\nonly screen and ( -o-min-device-pixel-ratio: 2\/1) and (min-width: 1300px),\r\nonly screen and ( min-device-pixel-ratio: 2) and (min-width: 1300px),\r\nonly screen and ( min-resolution: 192dpi) and (min-width: 1300px),\r\nonly screen and ( min-resolution: 2dppx) and (min-width: 1300px) { \r\n\r\n \/* Large screen, retina, stuff to override above media query *\/\r\n\r\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"For including high-res graphics, but only for screens that can make use of them. “Retina” being “2x”: @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { \/* Retina-specific stuff here *\/ } Or other highish-res: \/* 1.25 dpr *\/ @media (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi){ \/* Retina-specific stuff here *\/ } \/* 1.3 dpr *\/ @media (-webkit-min-device-pixel-ratio: 1.3), (min-resolution: […]<\/p>\n","protected":false},"author":3,"featured_media":0,"parent":3222,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"page-snippet.php","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"c2c_always_allow_admin_comments":false,"footnotes":""},"tags":[],"acf":[],"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/17757"}],"collection":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/comments?post=17757"}],"version-history":[{"count":6,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/17757\/revisions"}],"predecessor-version":[{"id":18763,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/17757\/revisions\/18763"}],"up":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/3222"}],"wp:attachment":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media?parent=17757"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/tags?post=17757"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}