margin-collapse-114.xht (2296B)
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 2 <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <title>CSS Test: Margin Collapsing: in flow (position of collapsed-through element)</title> 5 <link rel="author" title="Ian Hickson" href="mailto:ian@hixie.ch"/> 6 <link rel="reviewer" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> <!-- 2012-08-17 --> 7 <link rel="alternate" href="http://www.hixie.ch/tests/adhoc/css/box/block/margin-collapse/014.html" type="text/html"/> 8 <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins"/> 9 <link rel="match" href="margin-collapse-114-ref.xht" /> 10 11 <style type="text/css"> 12 table { border-spacing: 0; font-size: 50px; border: solid 3px; background: red; } 13 td { padding: 0; vertical-align: top;} 14 /* test */ 15 .test { background: orange; width: 1em; } 16 .test .a { background: yellow; margin: 0 0 1em 0; height: 1em; } 17 .test .b { background: red; margin: 2em 0 0 0; position: relative; } 18 .test .c { background: lime; margin: 3em 0 0 0; height: 1em; } 19 .test .d { background: aqua; margin: 2em 0 1em 0; height: 1em; width: 100%; } 20 .test .pos { position: absolute; } 21 .test .float { float: left; } 22 /* control */ 23 .control div { width: 1em; } 24 .control .a { border-top: 1em yellow solid; } 25 .control .b { border-top: 3em orange solid; } 26 .control .c { border-top: 1em lime solid; } 27 .control .d { border-top: 1em aqua solid; } 28 .control .e { border-top: 1em orange solid; } 29 </style> 30 </head> 31 <body> 32 <p>Test passes if there is a stack of 5 bands which are <strong>from top to bottom: yellow, orange, lime, aqua, orange</strong> with no red.</p> 33 <table> 34 <tr> 35 <td class="test"> 36 <div class="a"></div> 37 <div class="b"> 38 <div class="d pos"></div> 39 </div> 40 <div class="c"></div> 41 </td> 42 <td class="test"> 43 <div class="a"></div> 44 <div class="b"> 45 <div class="d float"></div> 46 </div> 47 <div class="c"></div> 48 </td> 49 <td class="control"> 50 <div class="a"></div> 51 <div class="b"></div> 52 <div class="c"></div> 53 <div class="d"></div> 54 <div class="e"></div> 55 </td> 56 </tr> 57 </table> 58 59 </body> 60 </html>