| 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, over-cons
trained</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-08-27 --> |
| 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-006-ref.xht
" /> |
| 9 |
| 10 <meta name="flags" content="" /> |
| 11 <meta name="assert" content="The 'bottom' value is ignored and the equat
ion solves for the bottom value, when the values for 'top', 'bottom', 'height',
'margin-top', 'margin-bottom' add up to more than the containing blocks height."
/> |
| 12 <style type="text/css"> |
| 13 #div1 |
| 14 { |
| 15 border: 10px solid black; |
| 16 height: 300px; |
| 17 position: relative; |
| 18 width: 300px; |
| 19 overflow: auto; |
| 20 } |
| 21 div div |
| 22 { |
| 23 background: blue; |
| 24 height: 150px; |
| 25 margin-bottom: 50px; |
| 26 margin-top: 50px; |
| 27 position: absolute; |
| 28 top: 50px; |
| 29 width: 50%; |
| 30 } |
| 31 #div2 |
| 32 { |
| 33 bottom: 50px; |
| 34 } |
| 35 |
| 36 /* |
| 37 |
| 38 50px : top |
| 39 + |
| 40 50px : margin-top |
| 41 + |
| 42 0 : border-top-width |
| 43 + |
| 44 0 : padding-top |
| 45 + |
| 46 150px : height |
| 47 + |
| 48 0 : padding-bottom |
| 49 + |
| 50 0 : border-bottom-width |
| 51 + |
| 52 50px : margin-bottom |
| 53 + |
| 54 50px : bottom |
| 55 ============= |
| 56 350px while the height of containing block is only 300px. |
| 57 |
| 58 So, here we definitely have an overconstrained situation. In whi
ch |
| 59 case the spec clearly states |
| 60 "If the values are over-constrained, ignore the value for 'botto
m' |
| 61 and solve for that value." |
| 62 http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-height |
| 63 |
| 64 So, here, the used value for bottom will be 0px so that the equa
tion |
| 65 gets balanced. |
| 66 |
| 67 */ |
| 68 |
| 69 #div3 |
| 70 { |
| 71 bottom: 0; |
| 72 left: 50%; |
| 73 } |
| 74 </style> |
| 75 </head> |
| 76 <body> |
| 77 <p>Test passes if there is one and only one blue rectangle inside an hol
low black square and if such black square does not have a vertical scrollbar.</p
> |
| 78 <div id="div1"> |
| 79 <div id="div2"></div> |
| 80 <div id="div3"></div> |
| 81 </div> |
| 82 </body> |
| 83 </html> |
| OLD | NEW |