The Meaning of line-height

The definition of line-height in the spec has some problems.  In this
explanation I refer to computed values of line height only, because
inheritance is clearly defined (but poorly understood), since
complicating things with inheritance rules would make things only more
confusing.

In section 10.8.1 of CSS2, in the definition of line-height [1], the
spec says:

  If the property is set on a block-level element whose content is
  composed of inline-level elements, it specifies the minimal height of
  each generated inline box.

(It then continues by describing its meaning on inline-level elements,
with which I agree.)

This produces very strange results, because it means that a section of
smaller text within a paragraph, that has a smaller line-height (to
start) and that is baseline aligned would increase the height of the
line-box, because the smaller font-size (with the same line height,
because of the above) would make the leading considerably larger, and
thus enlarge the line-box at the bottom since half the leading goes on
each side of the inline box.

I think what was meant was that it specifies the minimal height of each
line box, not each inline box.  However, this says nothing about
vertical alignment in the case where the line-box height is smaller
without this rule.

Thus I think the rule should be the following:

  If the property is set on a block-level element whose content is
  composed of inline-level elements, it specifies the line-height of
  an anonymous inline box that contains all of the contents (in the
  normal flow) of the block-level element.  This anonymous box also
  has the font properties of the block-level element, so all other
  inline boxes are vertically aligned within it.

David Baron

[1] http://www.w3.org/TR/REC-CSS2/visudet.html#propdef-line-height

Received on Sunday, 10 January 1999 10:43:51 UTC