This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 15746 - Margin collapsing: zero-height, zero-min-height boxes with self-collapsing children no longer themselves self-collapse
Summary: Margin collapsing: zero-height, zero-min-height boxes with self-collapsing ch...
Status: NEW
Alias: None
Product: CSS
Classification: Unclassified
Component: CSS Level 2 (show other bugs)
Version: unspecified
Hardware: All Windows 3.1
: P2 normal
Target Milestone: ---
Assignee: Bert Bos
QA Contact: public-css-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-27 18:13 UTC by Anton P
Modified: 2012-12-04 00:54 UTC (History)
0 users

See Also:


Attachments

Description Anton P 2012-01-27 18:13:21 UTC
Reported by Anton Prowse

Consider the following test case:

<div style="margin:10px 0; height:0">
	<div style="margin:10px 0"></div>
</div>

The parent's margins don't collapse according to the current normative rules 
concerning adjacency since the bottom margin of the child is not 
adjacent to the bottom margin of the parent.  (Specifically, in this 
situation, the child self-collapses and the resulting margin collapses 
with the parent's top margin, but this new resulting margin doesn't 
collapse with the parent's bottom margin.)

But this makes the following note found in 8.3.1 incorrect: 

  # A box'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) collapse.

When a box's height is 0 then the note holds only when the box has no children, whereas when its height is 'auto' the note holds as given.

If this  change is desirable, then to resolve the conflict we could replace the item in the note with:

   | * A box'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 does not contain a line box, and it
   |   either has a 'height' of 0 and no in-flow children or it has
   |   a height of 'auto' and all of its in-flow children's margins
   |   (if any) collapse.

See: http://lists.w3.org/Archives/Public/www-style/2010Sep/0698.html


See also Bug 15745 which describes another conflict with the note mentioned.