| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/st
rict.dtd"> | |
| 2 <html> | |
| 3 <head> | |
| 4 <title>CSS Test: Absolutely positioned non-replaced elements with left,
width, right and margin-right not auto</title> | |
| 5 <link rel="author" title="Microsoft" href="http://www.microsoft.com/"> | |
| 6 <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#abs-non-r
eplaced-width"> | |
| 7 <meta name="flags" content="ahem"> | |
| 8 <script src="../../resources/ahem.js"></script> | |
| 9 <meta name="assert" content="If 'left', 'width', 'right' and 'margin-rig
ht' are all not 'auto' and 'margin-left' is 'auto', then solve the equation for
'margin-left'."> | |
| 10 <style type="text/css"> | |
| 11 #containingblock | |
| 12 { | |
| 13 border: solid black; | |
| 14 direction: ltr; | |
| 15 height: 2in; | |
| 16 position: relative; | |
| 17 width: 3in; | |
| 18 } | |
| 19 div div | |
| 20 { | |
| 21 /* left + margin-left + border-left-width + padding-left + width
+ padding-right + border-right-width + margin-right + right = width of containi
ng block */ | |
| 22 /* 1in + solve + 0 + 0 + 1in
+ 0 + 0 + 1in + 1in = 3in */ | |
| 23 background: red; | |
| 24 color: blue; | |
| 25 font: 1in/1em Ahem; | |
| 26 left: 1in; | |
| 27 margin-left: auto; /* value is solved to -1 */ | |
| 28 margin-right: 1in; | |
| 29 position: absolute; | |
| 30 right: 1in; | |
| 31 width: 1in; | |
| 32 } | |
| 33 </style> | |
| 34 </head> | |
| 35 <body> | |
| 36 <p>Test passes if the blue square is in the upper-left corner of the bla
ck rectangle and there is no red visible on the page.</p> | |
| 37 <div id="containingblock"> | |
| 38 <div>X</div> | |
| 39 </div> | |
| 40 </body> | |
| 41 </html> | |
| OLD | NEW |