dynamic-top-change-003.xht (1979B)
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: Inheriting 'top' changes from parent table through anonymous table boxes</title> 5 <link rel="author" title="Boris Zbarsky" href="mailto:bzbarsky@mit.edu"/> 6 <link rel="reviewer" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact"/> 7 <link rel="help" href="http://www.w3.org/TR/CSS21/cascade.html#value-def-inherit"/> 8 <link rel="help" href="http://www.w3.org/TR/css-cascade-3/#inherit"/> 9 <link rel="help" href="http://www.w3.org/TR/css-cascade-4/#inherit"/> 10 <link rel="help" href="http://www.w3.org/TR/CSS21/visuren.html#position-props"/> 11 <link rel="help" href="http://www.w3.org/TR/CSS21/visuren.html#propdef-position"/> 12 <link rel="match" href="dynamic-top-change-002-ref.xht" /> 13 14 <meta name="flags" content="dom" /> 15 <meta name="assert" content="The position of a positioned element which inherits its 'top' value from its parent changes when the parent's 'top' value is changed even if the parent is display:table."/> 16 <style type="text/css"><![CDATA[ 17 p 18 { 19 line-height: 1.25; 20 margin: 1em 0; 21 } 22 23 strong {line-height: 1;} 24 25 .testDiv { width: 100px; height: 100px; } 26 #green { top: 4em; background: green; position: absolute; } 27 #red { top: inherit; background: red; position: relative; } 28 #parent { position: absolute; top: 2em; } 29 #intermediate { display: table; } 30 ]]></style> 31 <script type="text/javascript"><![CDATA[ 32 window.onload = function() { 33 document.body.offsetWidth; 34 document.getElementById("intermediate").style.top = "2em"; 35 } 36 ]]></script> 37 </head> 38 <body> 39 <p>Test passes if there is <strong>no red</strong>.</p> 40 <div id="parent"> 41 <div id="intermediate"> 42 <div id="red" class="testDiv"></div> 43 </div> 44 </div> 45 <div id="green" class="testDiv"></div> 46 </body> 47 </html>