margin-collapse-with-indefinite-block-size-005.html (1092B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <link rel="author" title="Oriol Brufau" href="obrufau@igalia.com"> 4 <link rel="help" href="https://drafts.csswg.org/css2/#collapsing-margins"> 5 <link rel="help" href="https://drafts.csswg.org/css-sizing-3/#behave-auto"> 6 <link rel="help" href="https://drafts.csswg.org/css-sizing-4/#stretch-fit-sizing"> 7 <link rel="match" href="../reference/ref-filled-green-100px-square.xht"> 8 <meta name="assert" content=" 9 According to CSS2, the bottom margin of a block container can collapse 10 with the bottom margin of its last in-flow child if `height` computes 11 to `auto`. 12 13 However, according to CSS Sizing, that was 'legacy spec prose' and 14 should be interpreted as 'behaves as `auto`'. 15 16 Therefore, an indefinite `stretch` in the preferred block size property 17 shouldn't prevent margin collapse, because it behaves as `auto`. 18 "> 19 20 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 21 <div style="width: 100px; height: stretch; background: red"> 22 <div style="height: 100px; margin-bottom: 100px; background: green"></div> 23 </div>