| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/x
html1/DTD/xhtml1-strict.dtd"> |
| 2 <html xmlns="http://www.w3.org/1999/xhtml"> |
| 3 <head> |
| 4 <title>CSS Test: Absolutely positioned, non-replaced elements, height is
based on the content</title> |
| 5 <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> |
| 6 <link rel="reviewer" title="Gérard Talbot" href="http://www.gtal
bot.org/BrowserBugsSection/css21testsuite/" /> <!-- 2012-09-01 --> |
| 7 <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-r
eplaced-height" /> |
| 8 <link rel="match" href="absolute-non-replaced-height-009-ref.xht
" /> |
| 9 |
| 10 <meta name="flags" content="ahem" /> |
| 11 <meta name="assert" content="The 'height' is based on the content height
, 'auto' values for 'margin-top' and 'margin-bottom' are set to '0' when 'height
' and 'bottom' are 'auto' and 'top' is not 'auto'." /> |
| 12 <style type="text/css"> |
| 13 #div1 |
| 14 { |
| 15 position: relative; |
| 16 } |
| 17 div div |
| 18 { |
| 19 background: blue; |
| 20 bottom: auto; |
| 21 color: orange; |
| 22 font: 100px/1 Ahem; |
| 23 height: auto; |
| 24 margin-bottom: auto; |
| 25 margin-top: auto; |
| 26 position: absolute; |
| 27 top: 25px; |
| 28 width: 200px; |
| 29 } |
| 30 |
| 31 <!-- |
| 32 " |
| 33 height' and 'bottom' are 'auto' and 'top' is not 'auto', |
| 34 then the height is based on the content per 10.6.7, |
| 35 set 'auto' values for 'margin-top' and 'margin-bottom' to 0, |
| 36 and solve for 'bottom' |
| 37 " |
| 38 http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-height |
| 39 |
| 40 In this test, |
| 41 top used value will be 25px |
| 42 height used value will be 100px |
| 43 vertical margins will be 0px |
| 44 bottom used value will be -125px |
| 45 because the computed height of containing block is 0px. |
| 46 --> |
| 47 |
| 48 </style> |
| 49 </head> |
| 50 <body> |
| 51 <p>Test passes if the orange and blue squares have the <strong>same heig
ht</strong>.</p> |
| 52 <div id="div1"> |
| 53 <div>X</div> |
| 54 </div> |
| 55 </body> |
| 56 </html> |
| OLD | NEW |