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

Re: [CSS21] Issue 181 confusion over the height of inline-level boxes

From: Bert Bos <bert@w3.org>
Date: Fri, 25 Mar 2011 19:09:00 +0100
To: Anton Prowse <prowse@moonhenge.net>
Cc: W3C style mailing list <www-style@w3.org>
Message-Id: <201103251909.00984.bert@w3.org>
On Sunday 06 March 2011 19:13:13 Anton Prowse wrote:
> On 04/03/2011 17:09, Bert Bos wrote:
> > (See http://wiki.csswg.org/spec/css2.1#issue-181)
> > 
> > The first list item in section 10.8 (Line height calculations: the
> > 'line-height' and 'vertical-align' properties[1]) in the current
> > draft
> > 
> > says:
> > |  1. The height of each inline-level box in the line box is
> > |  calculated
> > |  
> > |     (see "Calculating heights and margins" and the 'line-height'
> > |     property).
> > 
> > That is confusing, because the height is not the content height and
> > you have to follow the links to know what height it actually is. I
> > had an
> > 
> > action to make this clear and this is my change:
> >     1. The height of each inline-level box in the line box is
> >     calculated.
> >     
> >        For replaced elements, inline-block elements, and
> >        inline-table elements, this is the height of their margin
> >        box; for inline boxes, this is their 'line-height'. (See
> >        "Calculating heights and margins" and the height of inline
> >        boxes in "Leading and half- leading".)
> 
> But this contradicts your resolution to Issue 118 which is now in the
> WD:
> 
>    # 10.8.1 Leading and half-leading
>    #
>    # Still for each glyph, determine the leading L to add, where L =
>    # line-height - AD. Half the leading is added above A and the other
>    # half below D, giving the glyph and its leading a total height 
above
>    # the baseline of A' = A + L/2 and a total depth of D' = D + L/2.
>    #
>    # The height of the inline box is then the smallest such that it
>    # encloses all glyphs and their leading, as well as all nested 
inline
>    # boxes.
> 
> According to that, the height of a non-replaced inline box is the
> minimum which encloses all glyphs and their leading (which, by
> construction, is the value of 'line-height' even in cases of
> fallbacks from other fonts) *and* encloses all nested inline boxes. 
> The latter isn't very clear; I suppose it means that, for each
> nested inline box, it encloses the vertical extremities of the
> rectangle whose height is equal to the height of the inline box (cf.
> my concept of "guide boxes"). If so, the height of a non-replaced
> inline box may certainly be bigger than its 'line-height'.

We have since changed the last of the sentences you quoted so that the 
height of an inline box does *not* depend on child elements and is thus 
guaranteed to be 'line-height'. We needed that for issue 153[1], which 
requires a box of that height for 'vertical-align' to work on. You can 
see the new text in the snapshot[2].

[1] http://wiki.csswg.org/spec/css2.1#issue-153
[2] http://www.w3.org/Style/css2-updates/draft-PR-
CSS21-201103XX/visudet.html#leading

> 
> Note that what the current WD says seems to be a change from what the
> spec used to say (and still says) in 10.6.1:
> 
>    # only the 'line-height' is used when calculating the height of the
>    # line box.

That is issue 281[3] and we improved the somewhat sloppy sentence to 
this:

    The vertical padding, border and margin of an inline, non-replaced
    box start at the top and bottom of the content area, and has nothing
    to do with the 'line-height'. But only the 'line-height' is used
    when calculating the height of the line box.[4]

[3] http://wiki.csswg.org/spec/css2.1#issue-281
[4] http://www.w3.org/Style/css2-updates/draft-PR-
CSS21-201103XX/visudet.html#inline-non-replaced


Does that close issue 181?

 
> Moreover, I'm suspicious that the new text for 10.8.1 doesn't have
> browser support / interop (since it's a significant change to what
> the spec used to imply) but I haven't tested that yet.




Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos                               W3C/ERCIM
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Friday, 25 March 2011 18:09:30 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:38 GMT