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

On Mon, 26 Mar 2001, James Aylard wrote:
> [...]

All your reasoning so far is perfect.


> So: a line box which contains a single inline box, which in turn
> contains an image of, say, 5 pixels in height -- with "auto" or "0"
> for its "top", "bottom", "margin-top", and "margin-bottom" settings
> -- will itself be 5 pixels in height.

No. You have forgotten section 10.8.1, which says how 'line-height'
applies to blocks [1]:

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

The initial value of 'line-height' is normal, which is a UA dependent
<number> that depends on the value of 'font-size' [1]:

# normal
#   Tells user agents to set the computed value to a "reasonable"
#   value based on the font size of the element. The value has the
#   same meaning as <number>. We recommend a computed value for
#   'normal' between 1.0 to 1.2.

Thus, per the spec, your image won't be 5 pixels high, it will in fact
be just over 1em high (i.e., a bit bigger than the font size). (I am
assuming here that the font size is set to more than 5 pixels.)

That's if you take the spec literally.

I suspect, however, that the spec meant to say generated 'line box'
instead of 'generated inline box'.

If this is the case, then you are left with a line box that is taller
than its contents *after* alignment, and thus you have to make some
decision as to where to align the image. The spec doesn't say how to
do this.

David's inline box model proposes introducing a "root inline box",
which solves this problem. However, it is important to note that
David's proposal is not counter to the spec. The allowed behaviours
per David's proposal are actually a *subset* of the allowed behaviours
per the spec.

See also
   http://lists.w3.org/Archives/Public/www-style/1999Aug/0041.html
...which talks about this.


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

-- 
Ian Hickson                                     )\     _. - ._.)       fL
Netscape, Standards Compliance QA              /. `- '  (  `--'
+1 650 937 6593                                `- , ) -> ) \
irc.mozilla.org:Hixie _________________________  (.' \) (.' -' __________

Received on Monday, 26 March 2001 17:09:07 UTC