margin-collapse-031.xht (1185B)
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 2 3 <html xmlns="http://www.w3.org/1999/xhtml"> 4 5 <head> 6 7 <title>CSS Test: margin collapsing - child has no clearance</title> 8 9 <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> 10 <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins" /> 11 <link rel="match" href="margin-collapse-031-ref.xht" /> 12 13 <meta name="assert" content="The top margin of an in-flow block-level element is adjoining to its first in-flow block-level child's top margin if the element has no top border, no top padding, and the child has no clearance." /> 14 15 <style type="text/css"><![CDATA[ 16 body 17 { 18 background-color: white; 19 margin: 8px; 20 } 21 22 div#parent-block-container 23 { 24 background-color: red; 25 margin: 0px; 26 width: 100%; 27 } 28 29 div#child-block 30 { 31 background-color: green; 32 color: white; 33 margin: 100px 0px; 34 } 35 ]]></style> 36 37 </head> 38 39 <body> 40 41 <div id="parent-block-container"> 42 <div id="child-block"> 43 Test passes if there is <strong>no red</strong>. 44 </div> 45 </div> 46 47 </body> 48 </html>