W3C home > Mailing lists > Public > www-style@w3.org > February 2000

Re: line-height: <number>

From: Ian Hickson <py8ieh@bath.ac.uk>
Date: Fri, 4 Feb 2000 01:43:21 +0000 (GMT)
To: Erik van der Poel <erik@netscape.com>
cc: www-style <www-style@w3.org>
Message-ID: <Pine.GSO.4.04.10002040138280.11270-100000@mary.bath.ac.uk>

On Thu, 3 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.

No, it is always the computed value for 'line-height' that is
inherited, except if line-height is specified as a unit-less <number>.

Section 6.2:
# Specified percentage values are not inherited; computed values are.


> I think that percentages should be treated the same way as numbers.

If they were, then there would be no difference between numbers and
percentages. (But then there is no difference between 'em's and
percentages, the way things stand now.)


> 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).

Absolutely. That is why line-height should (almost) always be
specified using a <number>, not a <length> or <percentage>.

-- 
Ian Hickson                            ("`-''-/").___..--''"`-._   
http://www.bath.ac.uk/%7Epy8ieh/        `6_ 6  )   `-.  (     ).`-.__.`)
                                        (_Y_.)'  ._   )  `._ `. ``-..-' fL
Member, Mozilla Quality Assurance     _..`--'_..-_/  /--'_.' ,'
Browser Standards Compliance Team    (il).-''  (li).'  ((!.-'    
Received on Thursday, 3 February 2000 20:43:25 GMT

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