dynamic-top-change-004.xht (1817B)
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 abspos parent</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."/> 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; } 29 ]]></style> 30 <script type="text/javascript"><![CDATA[ 31 window.onload = function() { 32 document.body.offsetWidth; 33 document.getElementById("parent").style.top = "2em"; 34 } 35 ]]></script> 36 </head> 37 <body> 38 <p>Test passes if there is <strong>no red</strong>.</p> 39 <div id="parent"> 40 <div id="red" class="testDiv"></div> 41 </div> 42 <div id="green" class="testDiv"></div> 43 </body> 44 </html>