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

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

From: James Aylard <jaylard@pixelwright.com>
Date: Thu, 29 Mar 2001 09:52:46 -0800
Message-ID: <013d01c0b879$117619c0$2161398a@newcos.com>
To: "ValerieGSharp" <ValerieGSharp@netscapeonline.co.uk>
Cc: "Ian Hickson" <ian@hixie.ch>, <www-style@w3.org>, "Tantek Celik" <tantek@cs.stanford.edu>
Valerie, et al,

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

    After reading and re-reading the various related sections of the CSS 2
recommendation, I conclude that it *may* be read to mean what Ian and the
Mozilla team have concluded: that a td (treated as a block-level element)
containing only inline content (whether replaced or non-replaced inline
elements) may be assigned a line-height by default that is greater than the
height of the line box generated by the inline content, and that line-height
may supersede the height of the line box in determining the height of the
td.
    However, it is also possible to read the recommendation as Tantek has
(the wording, "If the property is set...", is unfortunately imprecise, and
appears in only one other section of the recommendation [1]).
    Further, if a td is treated as a block-level element, section 10.6.3
states that the height of a block-level element, if it has only inline-level
children, is "from the top of the topmost line box to the bottom of the
bottommost line box." [2] Since the height of replaced inline elements --
and thus the height of their line boxes -- does not include line-height, one
could read this section as an argument against the Mozilla interpretation.
    And I personally believe that the flavor of the CSS 2 recommendation
taken as a whole (a subjective interpretation, I know) argues against the
Mozilla interpretation, as does the historical behavior of tables.
    The greatest weakness of the Mozilla interpretation, however, is that it
hinges on the assumption that a td be treated as a simple block-level
element. Yet a td's presumed display property, as we know, is "table-cell",
not "block". And it does not seem unreasonable to me to extrapolate from
that difference that a table cell will be different from a simple block in
its behavior.
    In that light, I propose (using inexact terminology) that the height of
a table-cell element, if it contains only replaced inline elements, be based
on the height of the line boxes of its content, and not on any inherited or
presumed line-height of the cell.

James Aylard

1. Section 16.3.1, the 'text-decoration' property. The exact wording is
slightly different: "If the property is specified for a block-level
element...".
http://www.w3.org/TR/REC-CSS2/text.html#lining-striking-props
2. http://www.w3.org/TR/REC-CSS2/visudet.html#q17
Received on Thursday, 29 March 2001 12:52:42 GMT

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