Re: table border collapse and margins ins CSS2.1

Bernd Mielke wrote:
> 
> Section 17.6.2 of the CSS2.1 specification
> (http://www.w3.org/TR/CSS21/tables.html#collapsing-borders)
> 
> contains the  sentence:
> 
> Note only half of the two exterior borders are counted in the table
> width; the other half of these two borders lies in the margin area.
>
> ... IE and mozilla in the quirks mode compute the width as outer 
> border width and seem to be two interoperable implementations...
>
> I propose to remove the sentence from the specification as there are no 
> two interoperable implementations and to adapt the specification to the 
> IE/mozilla quirk rendering as far as width is concerned.

I disagree. I think the spec should instead be clarified to explicitly
include the width of the outer half of the border in the margin, either
by adding the extra width to the margin or by collapsing it with the
margin.

The borders should not be included in the table width because
   a) As Ian Hickson pointed out[1], this would affect fixed layout
   b) Drawing the width/height box around protruding borders (e.g.
      on individual cells)
         - skews centering
         - may be interpreted to cause backgrounds to leak through
           narrower borders (See [2] in Mozilla)

The borders should not leak out of the margin because then
   a) They overpaint adjacent content
   b) They make the table appear wider than its container
      (If you put a thin border around the container, the table's
       border will leak out of this box.)

My suggestion:
   For each side,
     - Find the widest effective border and the widest "full-length
       border" (table/colgroup/col for left & right sides, table/
       rowgroup/row for top & bottom sides -- these are the elements
       that stretch the full length of the side).
     - Add half the widest full-length border's width to the margin.
     - Make sure the resulting margin is at least as wide as the
       half the widest effective border minus the magnitude of the
       computed margin if it is negative.

   The advantage of this is that
     a) Small margins don't disappear by collapsing with the border
     b) Protruding borders don't affect centering (unless they're
        wider than the margin), but they also don't overpaint content.
     c) Negative margins still behave like negative margins; that is,
        content still overlaps by the specified amount.

Other alternatives:
   - For each side, add half the widest effective border width to the
     margin width.
or
   - For each side, make sure the actual margin is at least as wide as
     half the greatest effective border's width minus the magnitude of
     the computed margin if it is negative.

The computed value of the margin should not be affected by the borders.


IE/mozilla quirk rendering may not be considered interoperable
implementations because IEwin aligns the outer borders along the outer
edge while Mozilla aligns along the center-line as specified in CSS2. [2]
(This is how they avoid leaking the background.)

[1] http://bugzilla.mozilla.org/show_bug.cgi?id=155955#c17
[2] http://fantasai.tripod.com/www-style/2003/bc-table-border.html
     (Testcase)

Received on Saturday, 1 March 2003 18:01:58 UTC