<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>16037</bug_id>
          
          <creation_ts>2012-02-20 18:46:36 +0000</creation_ts>
          <short_desc>Margin collapsing: unintuitive collapsing between last child and auto-height, large min-height parent</short_desc>
          <delta_ts>2012-05-21 16:31:20 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>CSS</product>
          <component>CSS Level 2</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>ASSIGNED</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Anton P">antonsforums</reporter>
          <assigned_to name="Bert Bos">bert</assigned_to>
          
          
          <qa_contact>public-css-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>64314</commentid>
    <comment_count>0</comment_count>
    <who name="Anton P">antonsforums</who>
    <bug_when>2012-02-20 18:46:36 +0000</bug_when>
    <thetext>Reported by Anton Prowse

Issue 79 concerned the fact that people didn&apos;t like the discontinuity that arises in earlier versions of the spec when min-height on an auto-height element transitions from having no effect (in which case the element&apos;s bottom margin collapses with its last in-flow child&apos;s bottom margin) to having an effect (in which case those margins do not collapse): the parent&apos;s height is discontinuously increased to enclose the child&apos;s margin.  The WG resolved that those margins should collapse even when min-height has an effect. [http://lists.w3.org/Archives/Public/www-style/2008Nov/0473.html]

The motivation behind the resolution was to avoid discontinuities and to avoid the need to define partial margin collapsing (which was positively viewed in general but regarded as too complex a change at that point in the spec&apos;s life).  The key test case discussed was when the margin area height of a child with large bottom margin is slightly bigger than the parent&apos;s min-height; it was felt that the margins should collapse (matching what would have happened if the parent&apos;s min-height had been smaller) rather than have the parent expand its height to contain the child&apos;s margin.

However, this results in strange behaviour: when the parent&apos;s min-height is easily large enough to &quot;contain&quot; the last in-flow child&apos;s bottom margin, collapsing still occurs.  This is unintuitive for authors.

We must decide whether the specified behaviour is still desired.


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

URL
    http://lists.w3.org/Archives/Public/www-style/2008Sep/0112.html
Summary
    margin-collapsing with min-height
Proposal
    http://lists.w3.org/Archives/Public/www-style/2008Nov/0297.html
Resolution
    Proposal accepted (telcon 2008-12-10)
Status
    Closed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64316</commentid>
    <comment_count>1</comment_count>
    <who name="Anton P">antonsforums</who>
    <bug_when>2012-02-20 19:39:01 +0000</bug_when>
    <thetext>David Baron felt that preventing those margins from collapsing (or at least, making the behaviour undefined) when there is a non-zero min-height might be the way to go, but noted that implementations do fairly consistently collapse those margins. [http://lists.w3.org/Archives/Public/www-style/2010Sep/0451.html , http://lists.w3.org/Archives/Public/www-style/2011Mar/0346.html]

At the F2F in Paris 2012 [http://lists.w3.org/Archives/Public/www-style/2012Feb/0529.html] Alex Mogilevsky argued that implementers have resisted conditional margin collapsing that depends on whether min-height has an effect or not, since all other aspects of margin collapsing can be calculated before layout starts but not this one.  He also argued that we don&apos;t want to prevent margin collapsing when min-height didn&apos;t take effect (which, quite apart from being undesirable for authors, could also result in cycles since whether or not the min-height has an effect depends on whether or not the parent is expected to contain its child&apos;s margin).

The solution would seem to be to always permit collapsing even in the &quot;strange&quot; case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64317</commentid>
    <comment_count>2</comment_count>
    <who name="Anton P">antonsforums</who>
    <bug_when>2012-02-20 19:50:13 +0000</bug_when>
    <thetext>PROPOSAL:

Assuming that the above solution is agreed upon, then no change is needed to the normative spec text for the non-zero min-height case, but a change is needed to the Note in 8.3.1:

  # The bottom margin of an in-flow block box with a &apos;height&apos; of &apos;auto&apos;
  # and a &apos;min-height&apos; of zero collapses with its last in-flow
  # block-level child&apos;s bottom margin if the box has no bottom padding
  # and no bottom border and the child&apos;s bottom margin does not collapse
  # with a top margin that has clearance.

s/and a &apos;min-height&apos; of zero//
since it misleading to focus on the zero min-height case as if it were the only situation in which there can be collapsing between the margins described.

Note that the phrase in question was introduced [http://lists.w3.org/Archives/Public/www-style/2010Sep/0683.html] in response to David&apos;s point described in Comment 1.  I&apos;m not clear that it serves any purpose though, since it&apos;s not in the normative text and hence doesn&apos;t actually fulfil David&apos;s point anyhow.  Instead, it just seems to introduce confusion.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64325</commentid>
    <comment_count>3</comment_count>
    <who name="Anton P">antonsforums</who>
    <bug_when>2012-02-20 20:21:02 +0000</bug_when>
    <thetext>The proposal in Bug 16036 suggests that another change is needed to the quoted item in Comment 2 above.  The &quot;and a &apos;min-height&apos; of zero&quot; phrase actually ensures that the item remains correct in the light of the proposal!  However, the argument that it is misleading to focus on one particular case as if it were the only relevant case still stands, so here is an alternative proposal for this bug if the proposal for Bug 16036 is accepted:

Replace:

  # The bottom margin of an in-flow block box with a &apos;height&apos; of &apos;auto&apos;
  # and a &apos;min-height&apos; of zero collapses with its last in-flow
  # block-level child&apos;s bottom margin if the box has no bottom padding
  # and no bottom border and the child&apos;s bottom margin does not collapse
  # with a top margin that has clearance.

with:

  | The bottom margin of an in-flow block box with a &apos;height&apos; of &apos;auto&apos;
  | collapses with its last in-flow block-level child&apos;s bottom margin if
  | the box has no bottom padding and no bottom border and the child&apos;s
  | bottom margin neither collapses with a top margin that has clearance
  | nor (if the box&apos;s min-height is non-zero) with the box&apos;s top margin.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64340</commentid>
    <comment_count>4</comment_count>
    <who name="Anton P">antonsforums</who>
    <bug_when>2012-02-20 21:30:31 +0000</bug_when>
    <thetext>(See also http://lists.w3.org/Archives/Public/www-style/2008Nov/0022.html for more background to the WG resolution described in Commment 1.  Note that the strange behaviour was a known side-effect of the resolution.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66618</commentid>
    <comment_count>5</comment_count>
    <who name="Anton P">antonsforums</who>
    <bug_when>2012-04-11 16:05:15 +0000</bug_when>
    <thetext>An updated proposal is: [http://lists.w3.org/Archives/Public/www-style/2012Mar/0052.html]

Replace:
   #  - The bottom margin of an in-flow block box with a &apos;height&apos; of
   #    &apos;auto&apos; and a &apos;min-height&apos; of zero collapses with its last in-flow
   #    block-level child&apos;s bottom margin if the box has no bottom
   #    padding and no bottom border and the child&apos;s bottom margin does
   #    not collapse with a top margin that has clearance.

with:
   | - The bottom margin of an in-flow block box with a &apos;height&apos; of
   |   &apos;auto&apos; collapses with its last in-flow block-level child&apos;s bottom
   |   margin, if:
   |      - the box has no bottom padding, and
   |      - the box has no bottom border, and
   |      - the child&apos;s bottom margin neither collapses with a top margin
   |        that has clearance, nor (if the box&apos;s min-height is non-zero)
   |        with the box&apos;s top margin.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67972</commentid>
    <comment_count>6</comment_count>
    <who name="Anton P">antonsforums</who>
    <bug_when>2012-05-21 16:28:02 +0000</bug_when>
    <thetext>The WG resolved to accept the change proposed in Comment 5 to close this issue.

Minutes of resolution: http://lists.w3.org/Archives/Public/www-style/2012Apr/0276.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67975</commentid>
    <comment_count>7</comment_count>
      <attachid>1133</attachid>
    <who name="Anton P">antonsforums</who>
    <bug_when>2012-05-21 16:31:20 +0000</bug_when>
    <thetext>Created attachment 1133
testcase</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>1133</attachid>
            <date>2012-05-21 16:31:20 +0000</date>
            <delta_ts>2012-05-21 16:31:20 +0000</delta_ts>
            <desc>testcase</desc>
            <filename>testcase_bug-16037.html</filename>
            <type>text/html</type>
            <size>527</size>
            <attacher name="Anton P">antonsforums</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCjxoZWFkPg0KCTx0aXRsZT5UZXN0Y2FzZSBmb3IgQnVn
IDE2MDM3PC90aXRsZT4NCjwvaGVhZD4NCjxib2R5Pg0KPGRpdiBjbGFzcz0idGVzdC1jb25kaXRp
b24iPg0KCTxwPlRoZXJlIHNob3VsZCBiZSBvbmUgc29saWQgZ3JlZW4gc3F1YXJlIGFuZCBubyBy
ZWQgb24gdGhpcyBwYWdlPC9wPg0KPC9kaXY+DQoNCjxkaXYgaWQ9ImNvbnRhaW5lciIgc3R5bGU9
IndpZHRoOjUwcHg7IGhlaWdodDoxNTBweDsgYm9yZGVyLWJvdHRvbTo1MHB4IHNvbGlkIHJlZCI+
DQoJPGRpdiBpZD0icGFyZW50IiBzdHlsZT0iaGVpZ2h0OmF1dG87IG1pbi1oZWlnaHQ6MTAwcHgi
Pg0KCQk8ZGl2IGlkPSJjaGlsZCIgc3R5bGU9ImhlaWdodDo1MHB4OyBtYXJnaW4tYm90dG9tOjUw
cHgiPjwvZGl2Pg0KCTwvZGl2Pg0KCTxkaXYgaWQ9ImZvbGxvd2luZy1zaWJsaW5nIiBzdHlsZT0i
aGVpZ2h0OjUwcHg7IGJhY2tncm91bmQtY29sb3I6Z3JlZW4iPjwvZGl2Pg0KPC9kaXY+DQoNCjwv
Ym9keT4NCjwvaHRtbD4=
</data>

          </attachment>
      

    </bug>

</bugzilla>