Re: line-height: <number>

Ian Hickson wrote:
> 
> On Tue, 1 Feb 2000, Erik van der Poel wrote:
> 
> > [ line-height: <number> ]
> >
> > (1) It says "multiplied by the element's font size". Would that be
> > the computed or actual value of font-size?
> 
> The same as with 'em'. i.e., a line-height of '3.4' means '3.4em'. The
> only difference between specifying 'em' and <number> for 'line-height'
> is the rather important difference in how it is inherited.

The spec says:

  The 'em' unit is equal to the computed value of the
  'font-size' property of the element on which it is used.

The above can be found here:

  http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-length

So, as far as I can tell, the *specified* value "3.4em" is inherited by
a child element, and you then multiply 3.4 by the font-size of that
child element, not the parent element where line-height was inherited
from.

And of course we have the computed vs actual problem. Em ought to refer
to the actual value of font-size.

> > (2) If the number is inherited, do we multiply it by the font-size
> > of the element that we inherited the number from, or by the
> > font-size of *this* element?
> 
> This element.

I think that percentages should be treated the same way as numbers.
However, the spec has an example (which is informative, not normative)
saying that percentages are inherited in such a way that they apply to
the parent's font-size:

  http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-percentage

I believe that example is wrong, and percentage should be treated just
like number. It's silly to use the font-size of a parent element, when
the font-size of the child could be quite different (e.g. larger).

Erik

Received on Thursday, 3 February 2000 20:21:53 UTC