Re: Clarify length units in CSS

Grant, Melinda wrote:
>  
> Dave said:
>> > 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.
>  
> My impression is that the misunderstanding is with the px unit, that 
> *it* is treated as an absolute measure.

There are really two questions:

1) Should UAs try to match absolute units to the real physical lengths?
    (Gecko does; WebKit doesn't)

2) Should CSS pixels be treated as absolute or relative?
    (WebKit hardcodes 1in==96px; Gecko tries to follow the spec, making
     CSS pixels relative, within some restrictions)

>  
> ROC said:
>>  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.
>  
> HP implements CSS px units as 1/96 inch. We tried the spec's suggestion 
> to use ~128px/in (.2mm/px for printed output) and map to a whole number 

Strictly speaking, CSS doesn't suggest ~128px/in, it suggests a reading 
distance of 21 inches for printed material. I think that causes a great 
deal of confusion for web developers, when everyone is speaking of '96 
pixels per inch' or '128 pixels per inch'. This has been repeated for so 
long that people started to believe it.

> of device pixels, but found that existing web content designs rely on a 
> px unit being 1/96 inch, so that approach isn't really interoperable. In 
> our implementation, a px is then rounded to the nearest device pixel. 
> (Our device resolutions are all 300 dpi and above.)
> 
> I don't believe we've seen any interoperability issues with the above 
> approach. I understand this gets dicier when moving to screen 
> resolutions of 143 dpi...  A programmable px unit could be helpful, but 
> it wouldn't address existing content...

I don't think anything can help here, simply because existing content 
that assumes 1in==96px is broken. Well, anything but forcing the web 
developers to fix their websites.

Using CSS pixels for layout is the most portable way. If I say I want 
something to be 10px, I want it to always visually appear the same size, 
regardless of whether the user uses a handheld device with a 5" screen 
or sees the content on a 20 foot billboard. But unfortunately no UA 
implements those units correctly.

tom

Received on Thursday, 24 July 2008 19:14:19 UTC