| OLD | NEW |
| (Empty) | |
| 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: Vertical centering with negative and positive top posit
ioning</title> |
| 5 <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> |
| 6 <link rel="help" href="http://www.w3.org/TR/CSS21/visuren.html#positioni
ng-scheme" /> |
| 7 <link rel="match" href="position-relative-nested-001-ref.xht" /> |
| 8 |
| 9 <meta name="flags" content="" /> |
| 10 <meta name="assert" content="Equal 50% positive and negative positioning
can vertically center objects." /> |
| 11 <style type="text/css"> |
| 12 #outer |
| 13 { |
| 14 background: green repeat-x center url('support/red_box.png'); |
| 15 /* red_box.png is a 100px by 100px red square */ |
| 16 height: 300px; |
| 17 width: 200px; |
| 18 } |
| 19 #inner |
| 20 { |
| 21 background-color: red; |
| 22 height: 100px; |
| 23 position: relative; |
| 24 top: 50% |
| 25 } |
| 26 #inner-most |
| 27 { |
| 28 background-color: green; |
| 29 height: 150px; |
| 30 /* 150px == top-half of red_box.png's height + #inner's height *
/ |
| 31 position: relative; |
| 32 top: -50%; |
| 33 /* 50% is 50% of the height of #inner-most's containing block |
| 34 which is #inner */ |
| 35 /* to move the top of the #inner-most box from pixel 150 |
| 36 on the y-axis of #outer to pixel 100 on the y-axis of #outer */ |
| 37 } |
| 38 </style> |
| 39 </head> |
| 40 <body> |
| 41 <p>Test passes if there is <strong>no red</strong>.</p> |
| 42 <div id="outer"> |
| 43 <div id="inner"> |
| 44 <div id="inner-most"></div> |
| 45 </div> |
| 46 </div> |
| 47 </body> |
| 48 </html> |
| OLD | NEW |