W3C home > Mailing lists > Public > www-style@w3.org > March 2001

Re: CSS 2: Table Cells and the "line-height" Property

From: ValerieGSharp <ValerieGSharp@netscapeonline.co.uk>
Date: Thu, 29 Mar 2001 16:23:47 +0100
Message-ID: <3AC35383.42BF739F@netscapeonline.co.uk>
To: Tantek Celik <tantek@cs.stanford.edu>
CC: Ian Hickson <ian@hixie.ch>, www-style@w3.org
This issue has been exercising my mind too. I find the spec
ambiguous/muddled re. the meaning of 'line-height' on block elements.

Certainly, substituting 'line box' for 'inline box' makes a little more
sense of it (e.g. "minimal" no longer contradicting "exact" in the next

But, from a theoretical point of view, it also make it anomalous in
relation to the calculation of the height of line boxes.
And from a practical point of view, it introduces non-essential white
space for no good reason in itself _and_ breaking backwards
compatibility, where the only content is replaced inline content.

In addition, "is set on" is definitely ambiguous, given that all
elements will at least have an inherited default 'line-height' value of
'normal'. (Generally, I would expect any property on any element to be
applied irrespective of how it was "set" - after all, even a default
value of inherit could be considered a deliberate choice on the part of
the author.)


>From an author's point of view, basically, I would expect 'line-height'
to behave rather like 'font-size' (after all, they go together in 'font'
shorthand properties e.g. 'font: 1em/1.5em sans-serif;'), with the
exception that relative values would be relative to the 'font-size' of
the element, rather than the 'line-height' of the parent:

-  I would expect non-replaced elements to inherit the 'line-height'
value of their containing block. (Actually, if I hadn't read the spec,
I'd probably expect the computed value to be inherited, somewhat
analogous to 'font-size'.)

-  I would expect a 'line-height' value of other than 'inherit' on a
non-replaced inline element to override the 'line-height' value of the
containing block.

-  I would expect 'line-height' to be meaningless on replaced inline
elements: replaced inline elements using the 'height' property, or
intrinsic height, to determine the height of the inline box.

-  I would expect the height of the line box to be determined by the
height of the inline boxes, not by the 'line-height' of the containing

Everything in the spec seems to indicate precisely that, but then that
sentence ("If the property is set on a block-level element ...") throws
it all off kilter.


Why not keep it simple and leave it to inheritance?:

  "On a block-level element the computed value becomes the value
inherited by inline-level content" 

  "On an inline-level element, it specifies the exact height of each box
generated by the element. (Except for inline replaced elements etc...)"

After all, if one changed the 'font-size' on an inline element but
wanted the same relative value for 'line-height', rather than the
inherited computed value, one could always set that same relative value
on the inline element, e.g.:

  #block  {font: 16pt/150% sans-serif;}
  #inline {font: 10pt sans-serif;}

would make the height of the inline box 24pt, and:

  #block  {font: 16pt/150% sans-serif;}
  #inline {font: 10pt/150% sans-serif;}

would make the height of the inline box 15pt.


But if we can't go down that road, then perhaps the following changes
would be in order:

  "On a block-level element, it specifies the minimal height of the
generated inline box for any non-replaced inline content.

  "On an inline-level element, it specifies the exact height of each box
generated by the element, unless that height is less than the minimal
height specified by the containing block, in which case the minimal
height will apply. (Except for inline replaced elements, where the
height of the box is given by the 'height' property.)"

I could live with that :-)

Val Sharp - Edinburgh
Received on Thursday, 29 March 2001 10:25:12 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:57 UTC