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

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

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 20 Mar 2001 17:06:40 -0800 (Pacific Standard Time)
To: James Aylard <jaylard@pixelwright.com>
cc: <www-style@w3.org>
Message-ID: <Pine.WNT.4.31.0103201644040.940-100000@HIXIE.netscape.com>
On Tue, 20 Mar 2001, James Aylard wrote:
>
> Thanks for your reply -- it was very thoughtful and worthwhile. But
> I'm still trying to decide if you are describing the CSS 2 box model
> as it exists, or if you are explaining how the Mozilla team have
> concluded it must be interpreted for purposes of its own implementation.

I was describing my interpretation of the specification, which, of course,
might be incorrect.

My interpretation is based heavily on David's interpretation.

David's interpretation is also what was used when deciding how to
implement this in Mozilla.


> If it's the latter, I would find that a worthwhile discussion. But
> what I'm really after is an explanation of what the existing CSS 2
> recommendation specifies.

I *believe* that it is the same thing. :-)


>> In conclusion: Yes, the size of inline replaced elements does play a
>> part, but they still have to be baseline aligned, the position of the
>> baseline is decided by the parent block element's font, and the line
>> box has a minimal size set by the parent block element's line-height.
>
> But the CSS 2 recommendation, section 17.5.3 [1], states:
>
># The baseline of a cell is the baseline of the first line box in the
># cell. If there is no text, the baseline is the baseline of whatever
># object is displayed in the cell, or, if it has none, the bottom of the
># cell box.

This is actually ambiguous. When the specification says "If there is no
text", it should really say "If there is no line box". There are various
ways of creating a line box without text, for example an empty inline
element generates a line box, as does whitespace (especially with 'white-
space' set to 'pre') and inline replaced elements such as images.

See, for instance, section 10.8:

# Empty inline elements generate empty inline boxes, but these boxes still
# have margins, padding, borders and a line height, and thus influence
# these calculations just like elements with content.

...or section 9.2.5:

# inline
#   This value causes an element to generate one or more inline boxes.

...or section 9.2.2:

# Anonymous inline boxes
#
# In a document like this:
#
#    <P>Some <EM>emphasized</em> text</P>
#
# The P generates a block box, with several inline boxes inside it. The
# box for "emphasized" is an inline box generated by an inline element
# (EM), but the other boxes ("Some" and "text") are inline boxes generated
# by a block-level element (P). The latter are called anonymous inline
# boxes, because they don't have an associated inline-level element.

In fact, lets take this example and look at it in detail:

   <P>Some <EM>emphasized</EM> text</P>

...generates (where capital letters indicate explicit boxes and lowercase
letters indicate anonymous boxes):

   <BLOCK>
     <line>
       <inline>Some </inline>
       <INLINE>emphasized</INLINE>
       <inline> text</inline>
     </line>
   </BLOCK>

Now removing the raw text nodes, we get

   <P><EM>emphasized</EM></P>

..., which generates:

   <BLOCK>
     <line>
       <INLINE>emphasized</INLINE>
     </line>
   </BLOCK>

And finally if we change the <EM> inline non-replaced element for an
<IMG> inline replaced element:

   <P><IMG/></P>

..., this generates:

   <BLOCK>
     <line>
       <INLINE/>
     </line>
   </BLOCK>

...so you still have the line box. As I understand it, anyway.

In my opinion the spec could be a lot more explicit about this. Hopefully
prose based on David's inline box model document will be used for the CSS3
version of the inline box model module...


> An image does not have a baseline, per se, does it?

Not per se, it is however aligned upon the baseline of the line box that
its presence (as an inline replaced element) has created. I think.


> Also, are there others in the working group who are willing to help
> clarify these apparent discrepancies of interpretation, especially
> members who are not part of the Mozilla development team? Ian has
> offered some excellent feedback, but I am also interested in a broader
> perspective.

Chris? Bert? Haakon?


> P.S. - Ian, you are a master of ASCII art!

Thanks... after a few years of drawing inline and block box model
diagrams, you would be too! ;-)


-- References --
> 1. http://www.w3.org/TR/REC-CSS2/tables.html#height-layout

-- 
Ian Hickson                                     )\     _. - ._.)       fL
Netscape, Standards Compliance QA              /. `- '  (  `--'
+1 650 937 6593                                `- , ) -  > ) \
irc.mozilla.org:Hixie _________________________  (.' \) (.' -' __________
Received on Tuesday, 20 March 2001 20:04:39 GMT

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