margin-collapse-min-height-002.xht (1488B)
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <title>CSS margin: Margin collapsing and elements with min-height</title> 5 <link rel="author" title="Bert Bos" href="mailto:bert@w3.org" /> 6 <link rel="help" href="http://www.w3.org/TR/CSS22/box.html#collapsing-margins" /> 7 <link rel="help" href="http://www.w3.org/TR/CSS22/changes.html#s.8.3.1c" /> 8 <link rel="match" href="margin-collapse-min-height-002-ref.xht" /> 9 <meta name="assert" content="If the top margin of a box with non-zero computed 'min-height' and 'auto' computed 'height' collapses with the bottom margin of its last in-flow child, then the child's bottom margin does not collapse with the parent's bottom margin." /> 10 <style type="text/css"> 11 #container {width: 50px; height: 50px; border-top: 1px solid transparent; 12 border-bottom: 100px solid red; background: green} 13 #parent {height: auto; min-height: 50px; background-color: white} 14 #child {margin-bottom: 50px} 15 #following-sibling {height: 50px; background-color: green} 16 </style> 17 </head> 18 <body> 19 <!-- Credit for this test goes to Anton Prowse, see 20 https://www.w3.org/Bugs/Public/show_bug.cgi?id=16036#c4 --> 21 <p>There should be two solid green squares and no red on this page</p> 22 <div id="container" > 23 <div id="parent"> 24 <div id="child"></div> 25 </div> 26 <div id="following-sibling"></div> 27 </div> 28 </body> 29 </html>