| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.or
g/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 2 <html xmlns="http://www.w3.org/1999/xhtml"> |
| 3 <head> |
| 4 <title>CSS Test: Absolutely positioned inline-block element with percent
age based height set to 'auto' and over-constrained values</title> |
| 5 <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> |
| 6 <link rel="reviewer" title="Gérard Talbot" href="http://www.gtalbot.org/
BrowserBugsSection/css21testsuite/" /> <!-- 2012-09-05 --> |
| 7 <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-repla
ced-height" /> |
| 8 <link rel="match" href="absolute-replaced-height-012-ref.xht" /> |
| 9 |
| 10 <meta name="flags" content="" /> |
| 11 <meta name="assert" content="An absolutely positioned inline-block repla
ced element with percentage height resolves based on the containing block height
when such height can be resolved." /> |
| 12 <style type="text/css"> |
| 13 #div1 |
| 14 { |
| 15 position: relative; |
| 16 height: 2in; |
| 17 } |
| 18 div div |
| 19 { |
| 20 border: solid green; |
| 21 height: 1in; |
| 22 position: absolute; |
| 23 top: 1in; |
| 24 width: 300px; |
| 25 } |
| 26 iframe |
| 27 { |
| 28 border: solid red; |
| 29 bottom: 1in; |
| 30 margin-bottom: 0.5in; |
| 31 margin-top: 0.5in; |
| 32 position: absolute; |
| 33 top: 0.5in; |
| 34 width: auto; |
| 35 } |
| 36 |
| 37 /* |
| 38 |
| 39 0.5in : 'top' |
| 40 + |
| 41 0.5in : 'margin-top' |
| 42 + |
| 43 3px : 'border-top-width' medium which is often reso
lved as 3px |
| 44 + |
| 45 0 : 'padding-top' |
| 46 + |
| 47 1in : 'height' 50% of height of containing block |
| 48 + |
| 49 0 : 'padding-bottom' |
| 50 + |
| 51 3px : 'border-bottom-width' medium which is often r
esolved as 3px |
| 52 + |
| 53 0.5in : 'margin-bottom' |
| 54 + |
| 55 1in : 'bottom' |
| 56 ================ |
| 57 342px : height of containing block (192px) |
| 58 |
| 59 So, bottom has to be ignored and forced to have the value that |
| 60 will balance the equation. So, this brings up |
| 61 |
| 62 |
| 63 0.5in : 'top' |
| 64 + |
| 65 0.5in : 'margin-top' |
| 66 + |
| 67 3px : 'border-top-width' medium which is often resol
ved as 3px |
| 68 + |
| 69 0 : 'padding-top' |
| 70 + |
| 71 1in : 'height' 50% of height of containing block |
| 72 + |
| 73 0 : 'padding-bottom' |
| 74 + |
| 75 3px : 'border-bottom-width' medium which is often re
solved as 3px |
| 76 + |
| 77 0.5in : 'margin-bottom' |
| 78 + |
| 79 (solve) : 'bottom' |
| 80 ================ |
| 81 -246px : height of containing block (192px) |
| 82 |
| 83 So, the solved bottom value should be -54px . |
| 84 */ |
| 85 |
| 86 </style> |
| 87 </head> |
| 88 <body> |
| 89 <p>Test passes if there is <strong>no red</strong>.</p> |
| 90 <div id="div1"> |
| 91 <iframe height="50%"></iframe> |
| 92 <div></div> |
| 93 </div> |
| 94 </body> |
| 95 </html> |
| OLD | NEW |