margin-collapse-123.xht (1936B)
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 (with nearby collapse-through block)</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/023.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-123-ref.xht" /> 9 10 <style type="text/css"> 11 table, td { padding: 0; border-spacing: 0; } 12 .comparator { border-spacing: 1em; } 13 .test, .control { background: red; } 14 .test .container { display: block; margin: 0; width: 6em; background: yellow; border: solid; } 15 .test .float { float: left; margin: 0; height: 2em; width: 3em; background: orange; } 16 .test .empty { display: block; background: red; margin: 2em 0; } 17 .test .clear { clear: left; display: block; border-top: 2em solid orange; margin-top: 1em; } 18 .control table { border: solid; } 19 .control .square { height: 2em; width: 3em; } 20 .control .thin { height: 2em; width: 6em; } 21 .control .thick { height: 2em; width: 6em; } 22 .control .yellow { background: yellow; } 23 .control .orange { background: orange; } 24 </style> 25 </head> 26 <body> 27 <p>The following two rectangles should be identical.</p> 28 <table class="comparator"> 29 <tr> 30 <td class="test"> 31 <div class="container"> 32 <div class="float"> </div> 33 <div class="empty"> </div> 34 <div class="clear"> </div> 35 </div> 36 </td> 37 <td class="control"> 38 <table> 39 <tr> 40 <td class="square orange"></td> 41 <td class="square yellow"></td> 42 </tr> 43 <tr> 44 <td colspan="2" class="thin orange"></td> 45 </tr> 46 </table> 47 </td> 48 </tr> 49 </table> 50 51 52 </body> 53 </html>