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

    Whee doggies, this has been quite the conversation.  I'll see if I 
can't subtract from it.
    Consider an empty table cell (e.g., <td></td>).  Very few of us 
would argue that it contains a line box, any more than we would argue 
that an empty block-level element (e.g., <div></div>) contains a line 
box-- or, indeed, anything else.
    Unfortunately, images are by default inline elements, and so (in 
my view) create a inline box when they appear, and therefore either 
contribute to a line box, or create one to enclose their inline box. 
The fact that there isn't any actual text in the line is irrelevant, 
at least from the specification's point of view.  We humans may find 
this annoying, but that only means that we must either alter the 
specification, or get used to the annoyance.
    If you set an image to 'display: block', it becomes a block-level 
element and this whole messy inline formatting thing goes away, to be 
replaced by a different set of messy stuff.  It also happens that all 
this is a problem because inline images are, by default, defined to 
align their bottom edge with the baseline of the line box in which 
they appear.  If they were defined to align by default to the bottom 
of the line box, then we wouldn't have this problem.  (Thus the 
solution using 'vertical-align: bottom;'.)
    So: how about asking implementors to include a UA style which 
states something along the lines of:

    td > img, th > img {vertical-align: bottom;}

Would that be terribly inappropriate?  It covers the situation we 
have here, and while one could argue that authors ought to be doing 
this, perhaps this is one area where we could just not bother them. 
This also keeps implementors from having to do things like 
special-case table cells to treat 'line-height: normal' as 
'line-height: 0', which strikes me as technically valid but also a 
horrible twisting of the specification's intent.  And yes, I do care 
about intent, or else I wouldn't be trying to fix this at all.
    If this solution offends, consider allowing it in 
bugwards-compatible mode and not in strict mode and see if you're 
quite so offended.  If so, then let's hear why.

--
Eric Meyer
Internet Applications Manager          e-mail: emeyer@theopalgroup.com
The OPAL Group / Technical Services     voice: (216) 986-0710 ext. 21
  http://www.theopalgroup.com/             fax: (216) 986-0714

Received on Friday, 30 March 2001 16:19:54 UTC