Re: [CSS2.1] Clarifying 8.3.1 Collapsing Margins

On 18/08/2010 10:11, fantasai wrote:
> This is for CSS2.1 Issue 159
> triggered by this email
> This is version 2.

Great work!  I have a couple of comments about the current spec text
that you propose retaining.  Aside from the block formatting context
stuff which I think could be streamlined, these are:

>  | Vertical margins collapse if they are adjoining, except:
>  |   * Margins of the root element's box do not collapse.
>  |   * If the top and bottom margins of an element with clearance are
>  |     adjoining, its margins collapse with the adjoining margins of
>  |     subsequent siblings but that resulting margin does not collapse
>  |     with the bottom margin of the parent block.

The margins may not be mutually adjoining (indeed, frequently won't be
now that the concept is intransitive) yet they may still collapse.  The
sentence needs reformulating in terms of collapsing.  (Not easy to do
elegantly, unfortunately.)

>  | Horizontal margins never collapse.

>  | The above rules imply that:
>  |   * The bottom margin of an in-flow block element with a
>  |     'height' of 'auto' collapses with its last in-flow block-level
>  |     child's bottom margin if the element has no bottom padding or
>  |     border.

...unless the child has clearance and its top and bottom margins are

>  |   * An element's own margins collapse if the 'min-height' property
>  |     is zero, and it has neither top or bottom borders nor top or
>  |     bottom padding, and it has a 'height' of either 0 or 'auto', and
>  |     it does not contain a line box, and all of its in-flow children's
>  |     margins (if any) are adjoining.

This is confusing; "(if any)" qualifies children, not margins.

Also, as above, "adjoining" no longer covers all desired cases.  The
sentence needs reformulating in terms of collapsing.

>  | If the top and bottom margins of a box are adjoining, then it is
>  | possible for margins to collapse through it. In this case, the
>  | position of the element depends on its relationship with the other
>  | elements whose margins are being collapsed. [...]

As above:
s/are adjoining/collapse/

and, for readability,
s/for margins/for other margins/

Anyhow, this sentence was never correct, since there may not be any
other margins involved and so the applicability of this part is not just
restricted to "this case".  Really, the whole sentence needs changing:

   | If the top and bottom margins of a box collapse, the position of the
   | element is determined as follows.

Anton Prowse

Received on Wednesday, 18 August 2010 19:27:09 UTC