W3C home > Mailing lists > Public > www-style@w3.org > August 1999

RE: padded inline boxes and line boxes

From: L. David Baron <dbaron@fas.harvard.edu>
Date: Fri, 27 Aug 1999 15:17:38 -0400 (EDT)
Message-Id: <199908271917.PAA28297@ice4.fas.harvard.edu>
To: www-style@w3.org
On Fri, 27 Aug 1999 18:22:43 +0200, ament (ament@xs4all.nl) wrote:

> >Ranjit Singhe [mailto:ranjit_singhe@mail.com] wrote:
> >>notice in the s.shot that gecko does not respect vertical padding
> >>information.  in fact vertical padding behaves like negative margins (by
> >>that i mean sticking outside the line box rather than influencing the line
> >>box!).
> >>...should i
> >>let the vertical padding and border width influence the line box or not??
> >
> >No, you should not.  Gecko renders this case correctly according to the CSS
> >spec; vertical padding, border and margin are not supposed to influence the
> >line box.
> 
> I'm also implementing CSS2.
> 
> "vertical padding, border and margin are not supposed to influence the line
> box."
> Where do you see that in the text?

In CSS2, section 10.8.1:

  Although margins, borders, and padding of non-replaced elements do
  not enter into inline box height calculation (and thus the line box
  calculation), they are still rendered around inline boxes. This means
  that if the height of a line box is shorter than the outer edges of
  the boxes it contains, backgrounds and colors of padding and borders
  may "bleed" into adjacent line boxes. However, in this case, some
  user agents may use the line box to "clip" the border and padding
  areas (i.e., not render them).

It is also explained in CSS1, section 4.4:

  Note that any padding, border or margin above and below non-replaced
  inline elements does not influence the height of the line. In other
  words: if the 'line-height' is too small for the chosen padding or
  border, it will overlap with text on other lines.

The first sentence of 10.8.1 seems to refer to something that is
formally explained elsewhere.  It is an error (probably in section
10.6.1) that this is not clearer.  I think the error could be corrected
by revising section 10.6.1 to something like:

  If 'top', 'bottom', 'margin-top', or 'margin-bottom' are 'auto',
  their computed value is 0. The 'height' property doesn't apply.  For
  computing the height of the inline box, the height of the box is
  given by the 'line-height' property.  For drawing padding and border,
  the height of the box is given by the font-size property.  The
  difference between these two heights exists half on the top and half
  on the bottom, as described in section 10.8.1.


If you're implementing this part of CSS2, you may also be interested in
previous rants / discussions on this list about the inline box model:
(Hmmm... do I talk too much about this?)

Ambiguous cases:
http://lists.w3.org/Archives/Public/www-style/1999Mar/0121.html (me)

Anonymous boxes and how line-height acts on blocks:
http://lists.w3.org/Archives/Public/www-style/1999Jan/0027.html (me)
http://lists.w3.org/Archives/Public/www-style/1999Jan/0037.html (Ian Hickson)
http://lists.w3.org/Archives/Public/www-style/1999Aug/0041.html (me)

Actual versus computed values:
http://lists.w3.org/Archives/Public/www-style/1999Feb/0050.html (me)
(followed by series of responses discussing terminology)

A discussion on how the inline box model works (including some
discussion of ambiguous cases):
http://lists.w3.org/Archives/Public/www-style/1999Mar/0117.html (Eric Meyer)
http://lists.w3.org/Archives/Public/www-style/1999Mar/0118.html (me)
http://lists.w3.org/Archives/Public/www-style/1999Mar/0125.html (Eric Meyer)
http://lists.w3.org/Archives/Public/www-style/1999Mar/0128.html (me)

And you may also be interested in my test:

http://www.fas.harvard.edu/~dbaron/css/test/inlinetest

in which I carefully avoid many of these issues.

David

L. David Baron     Rising Sophomore, Harvard     dbaron@fas.harvard.edu
Links, SatPix, CSS, etc.        < http://www.fas.harvard.edu/~dbaron/ >
Summer Intern, Netscape - however, opinions are entirely my own, etc.
Received on Friday, 27 August 1999 15:17:38 GMT

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