floats-041.xht (1377B)
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 Test: Floats and stacking contexts with content</title> 5 <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> 6 <link rel="help" href="http://www.w3.org/TR/CSS21/visuren.html#floats" /> 7 <link rel="match" href="floats-041-ref.xht" /> 8 9 <meta name="assert" content="The contents of floats are stacked as if floats generated new stacking contexts." /> 10 <style type="text/css"> 11 div div 12 { 13 height: 0.5in; 14 width: 0.5in; 15 } 16 #div1 17 { 18 background: red; 19 float: left; 20 } 21 #div2 22 { 23 background: green; 24 display: block; 25 position: relative; 26 z-index: 10; 27 } 28 #div3 29 { 30 background: red; 31 position: relative; 32 } 33 </style> 34 </head> 35 <body> 36 <p>Test passes if there is no red.</p> 37 <div> 38 <div id="div1"> 39 <div id="div2"></div> 40 </div> 41 <div id="div3"></div> 42 </div> 43 </body> 44 </html>