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

Dimensions better than unitless numbers for future CSS specs

From: Etan Wexler <ewexler@stickdog.com>
Date: Thu, 07 Jul 2005 01:56:33 -0400
Message-ID: <42CCC411.1060906@stickdog.com>
To: CSS specification-development list <www-style@w3.org>

Bert Bos wrote to the CSS specification-development list 
<mailto:www-style@w3.org> on 5 July 2005 in “Re: Unitless dimensions” 
(<mid:200507052053.42160.bert@w3.org>, 
<http://www.w3.org/mid/200507052053.42160.bert@w3.org>):

> there is one property in CSS1 that allows both units and unitless
> numbers (line-height) and there is a proposal for two more in CSS3
> (width & height).

[...]

> The proposal in the CSS3 Box model is to allow 'width: 0.75' to mean 
> 0.75 times the intrinsic size. For example:
> 
>     <img src="..." alt="..." style="width: 10em">
> 
> makes an image of 10em wide, while
> 
>     <img src="..." alt="..." style="width: 0.75">
> 
> makes an image that is reduced to 75% of its original width.
> 
> I've also seen discussion of allowing unitless numbers on 'word-spacing' 
> in CSS3. Currently, 'word-spacing' adds a specific amount to the normal 
> spacing (for example, 'word-spacing: 0.5em'). 'Word-spacing: 1.5' could 
> mean that the word spacing is increased to 1.5 times its normal value.

We don’t need unitless numbers to effect a multiplication of intrinsic 
or normal values. A unit, say, 'norm', could give the same results. We 
can specify that 'norm' dimensions compute to themselves, yielding good 
results for inheritance in situations like the following example.

     <T-1 style="font-size: 8pt; word-spacing: 1.5norm">
         <T-2 style="font-size: 2em">
             Word spacing here is
             1.5 times the normal
             values for the used
             fonts at 16pt.
         </T-2>
     </T-1>

In some situations, a unitless number makes perfect sense. (The 
properties 'counter-increment', 'widows', and 'orphans' come to mind.) 
But, mostly, we should avoid unitless numbers.

The use of unitless numbers creates a system that is either inconsistent 
or inextensible. The system would be inconsistent if revisions allowed 
the use of dimensions in the same context as numbers. The system would 
be inextensible if dimensions came to rejection on the grounds of 
consistency.

-- 
Etan Wexler.
Received on Thursday, 7 July 2005 05:54:38 GMT

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