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

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 16 Feb 2012 12:52:32 -0800
Message-ID: <CAAWBYDCdooMT87C-MJLH-a8+ih11nptzpRpcA3bXQhp9rXjSig@mail.gmail.com>
To: Lea Verou <leaverou@gmail.com>
Cc: Sylvain Galineau <sylvaing@microsoft.com>, www-style list <www-style@w3.org>
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.

Received on Thursday, 16 February 2012 20:53:24 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:12 UTC