W3C home > Mailing lists > Public > www-style@w3.org > February 2012

Re: [css3-mediaqueries] DPI in resolution media queries

From: Simon Fraser <smfr@me.com>
Date: Thu, 16 Feb 2012 19:21:22 -0800
Cc: Lea Verou <leaverou@gmail.com>, Sylvain Galineau <sylvaing@microsoft.com>, www-style list <www-style@w3.org>
Message-id: <32AD4ECC-0C6A-4F16-B50B-339A4206A0A7@me.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
On Feb 16, 2012, at 12:52 pm, Tab Atkins Jr. wrote:

> On Thu, Feb 16, 2012 at 12:11 PM, Lea Verou <leaverou@gmail.com> wrote:
>> Opened netmagazine.com today, found yet another article documenting the
>> problem:
>> http://www.netmagazine.com/features/where-are-our-absolute-css-units
>> The writer seems to be under the impression that this is a browser bug that
>> goes against the spec.
>> 
>> I wonder what exactly is needed to convince you guys that this is a real
>> problem that needs a solution (any solution!).
> 
> There is no problem.  The specs are clear, simple, and more-or-less
> reasonable.  Mobile devices, though, are *astonishingly* buggy and
> wrong-headed about these things.  Note, for example, the "dp" unit
> that the netmag author talks about.  It's defined to be 1/160 of an
> inch.  The CSS px unit is defined to be 1/96 of an inch.  It's the
> *same* unit, just scaled differently.  The problem is that the
> creators of the dp unit have no idea what the px unit actually does,
> and likely assumed that it means "device pixels".
> 
> Having a "true" inch unit would *not* fix the problem that the author
> of the netmag article brings up.  You can, today, get a touch target
> that is at least 8mm square by setting its width and height to 45px.
> (This accounts for the maximum that the CSS in unit can deviate from a
> physical inch.)
> 
> The fact that the physical units can deviate up to a third in one
> degenerate case (when the screen is 144dpi) is unfortunate, of course,
> because if you try to account for it you'll get a larger-than-desired
> element in other resolutions (on a 96dpi or 192dpi screen, 45px is
> 12mm).  However, it'll at least be constant with the rest of the page.
> 
> I do support adding a single, small unit that implementations can
> attempt to align with the "real" unit, like truemm.  It should be
> relatively inconvenient to use for most purposes, thus hopefully
> avoiding the exact large-scale breakage that caused us to fix the
> ratio between the px and in units in the first place, but still useful
> for defining touch targets of a particular size.

I think there is a legitimate use case for a media query which is
able to discern the true dimensions of the screen.

Imagine a desktop screen which is 1024x768, and a tablet screen
that has the same pixel dimensions, but is physically much smaller.
Designers may need to style the page differently, or provide different
image assets purely because of the physical size difference. Without
physical length units, how else can they do this?

Simon
Received on Friday, 17 February 2012 03:22:11 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:50 GMT