{"id":3350,"date":"2013-06-03T19:34:39","date_gmt":"2013-06-03T17:34:39","guid":{"rendered":"http:\/\/gr-01.de\/www-whitepapers.grafik-und-redaktion.de\/?p=3350"},"modified":"2013-06-03T19:36:07","modified_gmt":"2013-06-03T17:36:07","slug":"css-media-queries-width-versus-device-width","status":"publish","type":"post","link":"https:\/\/whitepapers.grafik-und-redaktion.de\/?p=3350","title":{"rendered":"CSS media queries: width versus device-width"},"content":{"rendered":"<p>width versus device-width<\/p>\n<p>In CSS media the difference between width and device-width can be a bit muddled, so lets expound on that a bit. device-width refers to the width of the device itself, in other words, the screen resolution of the device. Lets say your screen&#8217;s resolution is 1440 x 900. This means the screen is 1440 pixels across, so it has a device-width of 1440px. Most mobile phones have a device-width of 480px or lower, including the popular iPhone 4 (with device-width: 320px), despite it technically having a 640 x 960 resolution. This is due to iPhone 4&#8217;s retina display, which crams two device pixels into each CSS pixel on the screen. This is true for the Ipad 3 as well; its reported device-width is 768px just like its predecessors, even though its actual screen resolution is 1536px x 2048px. In general width is more versatile when it comes to creating responsive webpages, though device-width is useful when you wish to specifically target mobile devices (and not desktops with a small browser window for example), as rarely do desktops have screen resolutions below a certain number such as 320px x 480px.<\/p>\n<p>The below shows the screen resolution and CSS media device dimensions of some of the popular devices out there:<\/p>\n<table width=\"80%\" border=\"1\" cellspacing=\"0\" cellpadding=\"3\">\n<caption><b>CSS Media Dimensions<\/b><\/caption>\n<tbody>\n<tr valign=\"top\">\n<th bgcolor=\"#D8EA99\" width=\"15%\">Device<\/th>\n<th bgcolor=\"#D8EA99\" width=\"42%\">resolution (px)<\/th>\n<th bgcolor=\"#D8EA99\" width=\"42%\">device-width\/ device-height (px)<\/th>\n<\/tr>\n<tr valign=\"top\">\n<td width=\"15%\">iPhone<\/td>\n<td width=\"42%\">320 x 480<\/td>\n<td width=\"42%\">320 x 480, in both portrait and landscape mode<\/td>\n<\/tr>\n<tr valign=\"top\">\n<td width=\"15%\">iPhone 4<\/td>\n<td width=\"42%\">640 x 960<\/td>\n<td width=\"42%\">320 x 480, in both portrait and landscape modeCSS<br \/>\npixel density is 2<\/td>\n<\/tr>\n<tr valign=\"top\">\n<td width=\"15%\">iPad 1 and 2<\/td>\n<td width=\"42%\">768 x 1024<\/td>\n<td width=\"42%\">768 x 1024, in both portrait and landscape mode<\/td>\n<\/tr>\n<tr valign=\"top\">\n<td width=\"15%\">iPad 3<\/td>\n<td width=\"42%\">1536 x 2048<\/td>\n<td width=\"42%\">768 x 1024, in both portrait and landscape modeCSS<br \/>\npixel density is 2<\/td>\n<\/tr>\n<tr valign=\"top\">\n<td width=\"15%\">Samsung Galaxy S I and II<\/td>\n<td width=\"42%\">480 x 800<\/td>\n<td width=\"42%\">320 x 533, in portrait modeCSS pixel density is 1.5<\/td>\n<\/tr>\n<tr valign=\"top\">\n<td width=\"15%\">Samsung Galaxy S III<\/td>\n<td width=\"42%\">720 x 1280<\/td>\n<td width=\"42%\">360? x 640?, in portrait mode<\/td>\n<\/tr>\n<tr valign=\"top\">\n<td width=\"15%\">HTC Evo 3D<\/td>\n<td width=\"42%\">540 x 960<\/td>\n<td width=\"42%\">360 x 640, portrait modeCSS pixel density is 1.5<\/td>\n<\/tr>\n<tr valign=\"top\">\n<td width=\"15%\">Amazon Kindle Fire<\/td>\n<td width=\"42%\">1024 x 600<\/td>\n<td width=\"42%\">1024 x 600, landscape mode<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>via <a href=\"http:\/\/www.javascriptkit.com\/dhtmltutors\/cssmediaqueries2.shtml\">CSS media queries: width versus device-width<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>width versus device-width In CSS media the difference between width and device-width can be a bit muddled, so lets expound on that a bit. device-width refers to the width of the device itself, in other words, the screen resolution of &hellip; <a href=\"https:\/\/whitepapers.grafik-und-redaktion.de\/?p=3350\">Weiterlesen &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48],"tags":[],"_links":{"self":[{"href":"https:\/\/whitepapers.grafik-und-redaktion.de\/index.php?rest_route=\/wp\/v2\/posts\/3350"}],"collection":[{"href":"https:\/\/whitepapers.grafik-und-redaktion.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/whitepapers.grafik-und-redaktion.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/whitepapers.grafik-und-redaktion.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/whitepapers.grafik-und-redaktion.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3350"}],"version-history":[{"count":1,"href":"https:\/\/whitepapers.grafik-und-redaktion.de\/index.php?rest_route=\/wp\/v2\/posts\/3350\/revisions"}],"predecessor-version":[{"id":3351,"href":"https:\/\/whitepapers.grafik-und-redaktion.de\/index.php?rest_route=\/wp\/v2\/posts\/3350\/revisions\/3351"}],"wp:attachment":[{"href":"https:\/\/whitepapers.grafik-und-redaktion.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3350"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/whitepapers.grafik-und-redaktion.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3350"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/whitepapers.grafik-und-redaktion.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3350"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}