tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

top-114.xht (2818B)


      1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      2 
      3 <html xmlns="http://www.w3.org/1999/xhtml">
      4 
      5  <head>
      6 
      7   <title>CSS Test: position relative - top offset percentage and inherit</title>
      8 
      9   <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
     10   <link rel="help" title="9.3.2 Box offsets: 'top', 'right', 'bottom', 'left'" href="http://www.w3.org/TR/CSS21/visuren.html#position-props" />
     11   <link rel="help" title="6.2.1 The 'inherit' value" href="http://www.w3.org/TR/CSS21/cascade.html#value-def-inherit" />
     12   <link rel="help" href="http://www.w3.org/TR/css-cascade-3/#inherit" />
     13   <link rel="help" href="http://www.w3.org/TR/css-cascade-4/#inherit" />
     14   <link rel="match" href="top-114-ref.xht" />
     15 
     16   <meta content="'top: inherit' makes the top property take the same computed value as the top property for the element's parent; in the case of a percentage value, the computed value is the specified percentage value. 'top: [percentage]' refers to height of containing block." name="assert" />
     17 
     18   <style type="text/css"><![CDATA[
     19   div {position: relative;}
     20 
     21   div#grand-parent-rel-pos
     22   {
     23   height: 400px;
     24   width: 600px;
     25   }
     26 
     27   div#red-rel-pos-overlapped
     28   {
     29   background-color: red;
     30   color: white;
     31   height: 100px;
     32   left: 300px;
     33   top: 50px;
     34   width: 100px;
     35   }
     36 
     37   div#parent-rel-pos
     38   {
     39   height: 0px;
     40   left: 50%; /* 50% x 600px == 300px */
     41   /* 'left: [percentage]' refers to width of containing block. */
     42   top: -12.5%; /* -12.5% x 400px == -50px */
     43   /* 'top: [percentage]' refers to height of containing block. */
     44   width: 100px;
     45   }
     46 
     47   div#green-child-rel-pos-inherit-overlapping
     48   {
     49   background-color: green;
     50   height: 100px;
     51   left: 0px;
     52   top: inherit;
     53   /*
     54   =====================================
     55   top: inherit should resolve as top: -12.5% because
     56   "the property takes the same computed value as the
     57   property for the element's parent"
     58   CSS 2.1, section 6.2.1 The 'inherit' value
     59   http://www.w3.org/TR/CSS21/cascade.html#value-def-inherit
     60   and
     61   "Computed value: (...) if specified as a percentage, [then]
     62   the specified [percentage] value"
     63   http://www.w3.org/TR/CSS21/visuren.html#position-props
     64 
     65   So, the top offset of #green-child-rel-pos-inherit-overlapping
     66   should be -12.5%, which is -12.5% of the height of its containing
     67   block (#parent-rel-pos) which is 0px.
     68   =====================================
     69   */
     70   width: 100px;
     71   }
     72   ]]></style>
     73 
     74  </head>
     75 
     76  <body>
     77 
     78   <p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
     79 
     80   <div id="grand-parent-rel-pos">
     81     <div id="red-rel-pos-overlapped">test FAILED</div>
     82     <div id="parent-rel-pos">
     83       <div id="green-child-rel-pos-inherit-overlapping"></div>
     84     </div>
     85   </div>
     86 
     87  </body>
     88 </html>