| 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 |
| 3 <html xmlns="http://www.w3.org/1999/xhtml"> |
| 4 |
| 5 <head> |
| 6 |
| 7 <title>CSS Test: CSS Test: absolutely positioned non-replaced element with 'le
ft' and 'right' not set to 'auto' and 'width' set to 'auto' - max-width, horizon
tal margins</title> |
| 8 |
| 9 <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserB
ugsSection/css21testsuite/" /> |
| 10 <link rel="help" title="10.3.7 Absolutely positioned, non-replaced elements" h
ref="http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width" /> |
| 11 <link rel="help" title="10.4 Minimum and maximum widths: 'min-width' and 'max-
width'" href="http://www.w3.org/TR/CSS21/visudet.html#min-max-widths" /> |
| 12 <link rel="match" href="absolute-non-replaced-width-025-ref.xht" /> |
| 13 |
| 14 <meta content="" name="flags" /> |
| 15 <meta content="When 'width' is computed according to the equation and rules of
section 10.3.7 and when such computed 'width' is greater than 'max-width', then
the equation and rules of section 10.3.7 are applied again but this time assumi
ng the computed 'max-width' value. Then all three properties ('width', 'left' an
d 'right') are not 'auto' and both 'margin-left' and 'margin-right' are 'auto':
in which case, the horizontal margins get equal values of available, remaining h
orizontal space." name="assert" /> |
| 16 |
| 17 <!-- |
| 18 Credit must go to Boris Zbarsky for explaining this in |
| 19 http://lists.w3.org/Archives/Public/www-style/2010Oct/0147.html |
| 20 --> |
| 21 |
| 22 <style type="text/css"><![CDATA[ |
| 23 body {margin: 8px;} |
| 24 |
| 25 div#overlapped-red |
| 26 { |
| 27 background-color: red; |
| 28 color: yellow; |
| 29 font-size: 2em; |
| 30 height: 100px; |
| 31 margin-left: auto; |
| 32 margin-right: auto; |
| 33 width: 100px; |
| 34 } |
| 35 |
| 36 div#abs-pos-overlapping-green |
| 37 { |
| 38 background-color: green; |
| 39 height: 100px; |
| 40 left: 8px; |
| 41 margin-left: auto; |
| 42 margin-right: auto; |
| 43 max-width: 100px; |
| 44 position: absolute; |
| 45 right: 8px; |
| 46 width: auto; |
| 47 } |
| 48 ]]></style> |
| 49 |
| 50 </head> |
| 51 |
| 52 <body> |
| 53 |
| 54 <p>Test passes if there is a green square <strong>horizontally centered</stron
g> in the page and if there is <strong>no red</strong>.</p> |
| 55 |
| 56 <div id="abs-pos-overlapping-green"></div> |
| 57 |
| 58 <div id="overlapped-red">FAIL</div> |
| 59 |
| 60 </body> |
| 61 </html> |
| OLD | NEW |