Re: Line height, images, vert. alignment, and so on

>On Sat, 27 Mar 1999 16:24:51 -0500, "Eric A. Meyer"
>( wrote:
>> Line-height
>> -----------
>>    So far as I can tell, the height of a line of text is determined by
>> whatever appears on that line.  For example, in CSS2, it says that:
>>     "When an element contains text that is rendered in more than one font,
>> user agents should determine the 'line-height' value according to the
>> font size." (CSS2:10.8.1)
>That sentence refers to the line-height of a single element that has
>multiple fonts.

   ...which, in a certain sense, are no different than other inline
elements, in that they have a height which may or may not be what was
specified.  I know, that's not how it's specified, but you could think of
them that way.

>The height of the *line* box is increased, but the height of the
>*inline* boxes (other than the image) are not.  The distinction is very
>important.  Inline boxes represent inline elements.  A line box
>contains inline elements or parts of inline elements.

   I just find this very hard to swallow.  If an image is part of a line,
and it's significantly taller than the text, then visually speaking, the
line height is increased to make vertical room for the image.  In CSS
terms, as you say, the line box is increased.  Given that, then why is the
computed 'line-height' for that line not increased as well?  Why are the
line's height, and the height of the line-box, so divorced from one
another?  I don't see why this is a good thing to do.  This is now perhaps
more a theoretical question than a "justify it under the spec" exercise.
   If it's felt that images should NOT increase the 'line-height' of a
line, then it seems to me that they ought not to be incresing the line-box
either, and therefore be overlapping text, just as radically increased
font-sizes are supposed to do.  Which, now that I think about it, is also a
little weird.
   Of course, I think that allowing negative margins to visually violate
the restrictions on where floats can be placed (and to allow children to be
wider than their parents) is really bad karma, so what do I know?

>>    Is it the case that making the line-box bigger also increases the
>> 'line-height'?  Because if so, the test for percentage values on
>No.  The value(s) of line-height describe the height of the inline boxes;
>the replaced element increases the height of the line box.

   Okay, I agree that there is a clear distinction written into the
specification, and the line-box model in general.  I just think it's a
little whacked that such a distinction exists.


Eric A. Meyer  -  -
 Editor, Style Sheets Reference Guide
 Coordinator, CSS1 Test Suite
 Member, WSP CSS Technical Committee

Received on Monday, 29 March 1999 09:44:49 UTC