1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html lang="en">
3 <head>
4 <title>CSS Test: Table layout: checking dynamic percentage margin layouts match initial layouts</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/table/dynamic/001.html" type="text/html">
7 <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#margin-properties">
8 <meta name="flags" content="dom">
9 <style type="text/css">
10 table { font-size: 4em; position: absolute; margin-top: 1em; }
11 td { border: solid; }
12 .control { color: red; }
13 .control div { margin-top: 10%; margin-left: 50%; }
14 .test { color: green; }
15 </style>
16 <script type="text/javascript">
17 function test() {
18 var element = document.getElementById('test');
19 element.offsetHeight; // Force initial layout
20 element.style.marginTop = "10%";
21 element.style.marginLeft = "50%";
22 }
23 </script>
24 </head>
25 <body onload="test();">
26 <p>There should be no red below, only green boxes with snowflakes in them.</p>
27 <table class="control">
28 <tr>
29 <td>
30 ❃
31 </td>
32 <td>
33 <div>❄</div>
34 </td>
35 <td>
36 ❅
37 </td>
38 </tr>
39 </table>
40 <table class="test">
41 <tr>
42 <td>
43 ❃
44 </td>
45 <td>
46 <div id="test">❄</div>
47 </td>
48 <td>
49 ❅
50 </td>
51 </tr>
52 </table>
53 </body>
54 </html>