margin-collapse-032.xht (1776B)
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 - resolving vertical padding percentage</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 <meta content="Adjoining of vertical (top and bottom) margins must be determined only after resolving percentage padding-top and padding-bottom values." name="assert" /> 12 13 <style type="text/css"><![CDATA[ 14 div#grand-parent-block-container 15 { 16 background-color: red; 17 border: black solid 3px; 18 /* Such border prevents margin collapsing with the body vertical margins */ 19 } 20 21 div#parent-block-container 22 { 23 background-color: green; 24 color: white; 25 padding: 2%; 26 } 27 28 div#child-block {margin: 100px 0px;} 29 30 /* 31 In this testcase, div#child-block's vertical (top and bottom) 32 margins should collapse with div#parent-block-container's vertical 33 (top and bottom) margins because div#child-block has no used 34 padding-top and no used padding-bottom. On the other hand, 35 div#parent-block-container's vertical (top and bottom) margins 36 should NOT collapse with div#grand-parent-block-container's vertical 37 (top and bottom) margins because div#parent-block-container, after 38 resolving percentage values, has an used padding-top value and an used 39 padding-bottom value. 40 */ 41 ]]></style> 42 43 </head> 44 45 <body> 46 47 <div id="grand-parent-block-container"> 48 <div id="parent-block-container"> 49 <div id="child-block"> 50 Test passes if there is <strong>no red</strong>. 51 </div> 52 </div> 53 </div> 54 55 </body> 56 </html>