W3C home > Mailing lists > Public > public-css-bugzilla@w3.org > February 2012

[Bug 16036] New: Margin collapsing: pathalogical collapsing behaviour for auto-height, non-zero min-height elements (Issue 211)

From: <bugzilla@jessica.w3.org>
Date: Mon, 20 Feb 2012 18:04:59 +0000
To: public-css-bugzilla@w3.org
Message-ID: <bug-16036-5148@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=16036

           Summary: Margin collapsing: pathalogical collapsing behaviour
                    for auto-height, non-zero min-height elements (Issue
                    211)
           Product: CSS
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: CSS Level 2
        AssignedTo: bert@w3.org
        ReportedBy: antonsforums@yahoo.co.uk
         QAContact: public-css-bugzilla@w3.org


Reported by David Baron.

The 2010-12-07 WD
(http://www.w3.org/TR/2010/WD-CSS2-20101207/box.html#collapsing-margins) and
some previous CRs contained an internal contradiction in the case of an
auto-height, non-zero min-height element with a single self-collapsing child. 
Section 8.3.1 said:

  % The bottom margin of an in-flow block box with a 'height' of 'auto'
  % is adjoining to its last in-flow block-level child's bottom margin
  % if the element has no bottom padding or border.
  % 
  % An element's own margins are adjoining 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.

The former paragraph says that the parent's bottom margin adjoins the child's
bottom margin (which adjoins its own top margin which adjoins the parent's top
margin [via other rules not quoted here]).  Yet the latter paragraph doesn't
cover the case in question (since min-height is non-zero) and so the
implication is that that the parent's top and bottom margin are not adjoining;
this was either a contradiction (if one believes that adjointness was
implicitly transitive) or else it was the exact same problem that the current
spec, with its new wording and terminology, now explicitly suffers from:

In the current spec, 8.3.1 (Collapsing margins) says:

  # Adjoining vertical margins collapse, except [omitted special cases]
  # [...]
  #
  # Two margins are adjoining if and only if:
  # [omitted conditions]
  # * both belong to vertically-adjacent box edges, i.e. form one of
  # the following pairs:
  #   - top margin of a box and top margin of its first in-flow child
  #   [omitted pair]
  #   - bottom margin of a last in-flow child and bottom margin of
  #     its parent if the parent has 'auto' computed height
  #   - top and bottom margins of a box that does not establish a new
  #     block formatting context and that has zero computed 'min-height',
  #     zero or 'auto' computed 'height', and no in-flow children
  #
  # A collapsed margin is considered adjoining to another margin if any
  # of its component margins is adjoining to that margin. 

So in the case being discussed, the parent's bottom margin adjoins the child's
bottom margin, which adjoins its own top margin which adjoins the parent's top
margin... and rather than this resulting in a contradiction, it simply means
that all margins explicitly collapse together, a pathalogical behaviour given
that the parent has non-zero used height.


A sensible resolution which handles this case is needed.



Issue 211: http://wiki.csswg.org/spec/css2.1#issue-211

Summary
    Transitivity error in margin collapsing
URI
    http://lists.w3.org/Archives/Public/www-style/2010Sep/0439.html
    http://lists.w3.org/Archives/Public/www-style/2010Sep/0451.html
Status
    Open. =errata= Deferred to Errata

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Monday, 20 February 2012 18:05:04 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 20 February 2012 18:05:05 GMT