W3C home > Mailing lists > Public > www-style@w3.org > July 2008

Re: Clarify length units in CSS

From: Robert O'Callahan <robert@ocallahan.org>
Date: Thu, 24 Jul 2008 13:14:48 +1200
Message-ID: <11e306600807231814w6ebb4c79qa676aed9b31063c2@mail.gmail.com>
To: "David Hyatt" <hyatt@apple.com>
Cc: "Tomas Carnecky" <tom@dbservice.com>, www-style@w3.org
On Thu, Jul 24, 2008 at 10:20 AM, David Hyatt <hyatt@apple.com> wrote:

>
> On Jul 22, 2008, at 4:02 PM, Tomas Carnecky wrote:
>
>  While I believe this is mostly what the spec intended (absolute units are
>> indeed absolute, relative units relative), in some cases it will
>> considerably differ. Let's say I'm sitting 28 inches from the screen. In
>> that case 96px should be the length of one physical inch. It is indeed if I
>> configure Gecko with DPI=N*96 (where N=1,2,3,...), but in all other cases
>> 96px will be different from one inch. This is especially well visible in the
>> case of DPI=143, when 1in is 50% larger then 96px (1in = 143 physical
>> pixels, 96px = 96 physical pixels).
>
>
In some future version of Gecko we might be able to relax the constraint
that 1 CSS px is an integer number of device pixels. Our zoom implementation
violates that constraint yet works surprisingly well, so the constraint
doesn't seem to be as important as we originally assumed.

WebKit on the other hand does not differ between CSS pixels and absolute
>> units. Absolute units have a constant relation to CSS pixels. 1in is always
>> exactly 96px, 1cm exactly 96/2.54px etc. This has the effect that 1in is
>> only one physical inch long when DPI=96. Comments in the code indicate that
>> this is intentional, WebKit doesn't see the 'absolute' lengths as absolute
>> but relative to a CSS pixel [1]
>>
>> So what is the correct interpretation of CSS lengths? Is Gecko or WebKit
>> right or maybe both wrong?
>>
>
> The problem is with the pt unit.  Web pages use the pt unit without
> understanding that it is supposed to be an absolute unit.  They intermix it
> with pixel units and then the Web site's design breaks if you ever change
> that ratio.
>

This is true, but so far I've only seen one bug report that traced back to
that issue. We're not experiencing any significant pressure to change our
behaviour.

Rob
-- 
"He was pierced for our transgressions, he was crushed for our iniquities;
the punishment that brought us peace was upon him, and by his wounds we are
healed. We all, like sheep, have gone astray, each of us has turned to his
own way; and the LORD has laid on him the iniquity of us all." [Isaiah
53:5-6]
Received on Thursday, 24 July 2008 01:15:26 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:10 GMT