margin-collapse-142.xht (2122B)
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: clear (hard)</title> 5 <link rel="author" title="Ian Hickson" href="mailto:ian@hixie.ch"/> 6 <link rel="alternate" href="http://www.hixie.ch/tests/adhoc/css/box/block/margin-collapse/042.html" type="text/html"/> 7 <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins"/> 8 <link rel="match" href="margin-collapse-142-ref.xht" /> 9 10 <style type="text/css"> 11 table, td { padding: 0; border-spacing: 0; vertical-align: top; } 12 .comparator { border-spacing: 1em; } 13 .test, .control { border: solid; background: red; } 14 .test .container { display: block; margin: 0; width: 8em; background: lime; } 15 .test .float { float: left; margin: 0; height: 4em; width: 4em; background: aqua; } 16 .test .clear { clear: left; display: block; background: yellow; margin: 4em 0; height: 4em; } 17 .test .block { display: block; margin: 1em 0 0; border: 2em solid #AAFFAA; } 18 .control .square { height: 4em; width: 4em; } 19 .control .rectangle { height: 4em; width: 8em; } 20 .control .AAFFAA { background: #AAFFAA; } 21 .control .lime { background: lime; } 22 .control .aqua { background: aqua; } 23 .control .yellow { background: yellow; } 24 </style> 25 </head> 26 <body> 27 <p>Test passes if there are 2 identical tall rectangles and <strong>no red</strong>.</p> 28 <table class="comparator"> 29 <tr> 30 <td class="test"> 31 <div class="container"> 32 <div class="float"> </div> 33 <div class="clear"> </div> 34 <div class="block"> </div> 35 </div> 36 </td> 37 <td class="control"> 38 <table> 39 <tr> 40 <td class="square aqua"></td> 41 <td class="square lime"></td> 42 </tr> 43 <tr> 44 <td colspan="2" class="rectangle yellow"></td> 45 </tr> 46 <tr> 47 <td colspan="2" class="rectangle lime"></td> 48 </tr> 49 <tr> 50 <td colspan="2" class="rectangle AAFFAA"></td> 51 </tr> 52 </table> 53 </td> 54 </tr> 55 </table> 56 57 58 </body> 59 </html>