W3C home > Mailing lists > Public > www-validator-css@w3.org > January 2010

[wishlist] A warning about absolute units

From: Bert Bos <bert@w3.org>
Date: Fri, 22 Jan 2010 21:31:44 +0100
To: www-validator-css@w3.org
Message-Id: <201001222131.45308.bert@w3.org>
Here is one for the wish list:

A common error in style sheets is to use the 'pt' unit in style sheets 
meant for the screen. That is nearly always a mistake, especially when 
the style sheet also uses 'px' in other places. Depending on the dot 
pitch of the screen, the size of a pt may vary between as much as 1 and 
2 px, thus if precise alignment is desired, it will fail on some 
screens, typically on higher-resolution screens with 100 to 200 dpi.

I did a quick check with a random sample of style sheets and found that 
most often people use 'pt' for 'font-size'. Maybe there is a (false) 
believe that fonts must be specified in points...

(Of the style sheets that used 'pt', quite a few had just a single rule 
with 'pt', nearly always a 'font-size', while other rules in the style 
sheets, including other 'font-size', used relative units. My guess is 
that those style sheets were originally made by designers, and then 
later somebody else made a local change...)

It would be nice if the validator gave a warning (not an error, 
obviously) when it found any absolute units 
('pt', 'mm', 'in', 'cm', 'pc'). The warning should say something about 
using absolute and relative units together and that they scale 
differently depending on the screen's dpi. Almost certainly the style 
sheet should use 'px' or 'em' instead.

Such a warning should not be given when it is known that the style sheet 
is only used for print.

  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos                               W3C/ERCIM
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Friday, 22 January 2010 20:32:16 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:40:46 UTC