margin-collapse-min-height-001.xht (1244B)
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-001-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 body {min-width: 17em} 12 div.parent {min-height: 2em; height: auto; margin: 1em 0} 13 div.last-child {margin-bottom: 5em} 14 div.float {float: left} 15 </style> 16 </head> 17 <body> 18 <div class="parent"> 19 <div></div> 20 <div></div> 21 <div class="last-child"> 22 <div class="float">There's more space above this line than between this line and the horizontal rule</div> 23 </div> 24 </div> 25 <hr /> 26 </body> 27 </html>