1 min

CSS media queries - 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 the device.

Lets say your screen's resolution is 1440 × 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 × 960 resolution.

This is due to iPhone 4'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.

read more at:
http://www.javascriptkit.com/dhtmltutors/cssmediaqueries2.shtml

#css - #design - #responsive

From JR's : articles
197 words - 1222 chars - 1 min read
created on
updated on
import date 2013-08-12 21:49:43 - #
source - versions - backlinks

Related articles
Breaking the web in 2014 - 2016 - May 31, 2016
CSS, HTML, Javascript, jQuery, jQuery Mobile, Typography, Accessibility, and Responsive Design Info - Sep 25, 2013
Fluidity.css - Mar 17, 2014
Interesting and related Treehouse online classes - May 08, 2013
Mar 23, 2015 links - Mar 23, 2015
more >>



A     A     A     A     A

© 2013-2017 JotHut - Online notebook

current date: Nov 14, 2024 - 1:45 a.m. EST