| 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 | |
| 4 <head> | |
| 5 | |
| 6 <title>CSS Test: Solving 'width: auto' of a block-level non-replaced element i
n normal flow with one other property set to an 'auto' value</title> | |
| 7 | |
| 8 <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserB
ugsSection/css21testsuite/"> | |
| 9 <link rel="help" title="10.3.3 Block-level, non-replaced elements in normal fl
ow" href="http://www.w3.org/TR/CSS21/visudet.html#blockwidth"> | |
| 10 <meta content="" name="flags"> | |
| 11 <meta content="If 'width' is set to 'auto', any other 'auto' values become '0'
and the determination of 'width' proceeds from the following equality: 'margin-
left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'bord
er-right-width' + 'margin-right' = width of containing block" name="assert"> | |
| 12 | |
| 13 <style type="text/css"> | |
| 14 div {height: 200px;} | |
| 15 | |
| 16 div#containing-block | |
| 17 { | |
| 18 border-right: red solid 200px; | |
| 19 padding-right: 200px; | |
| 20 width: 0px; | |
| 21 } | |
| 22 | |
| 23 div#child | |
| 24 { | |
| 25 border-right: green solid 200px; | |
| 26 margin-right: -400px; | |
| 27 } | |
| 28 | |
| 29 /* | |
| 30 Calculation of used width for div#child: | |
| 31 | |
| 32 margin-left : 0px (or auto) | |
| 33 + border-left-width : 0px | |
| 34 + padding-left : 0px | |
| 35 + width : auto | |
| 36 + padding-right : 0px | |
| 37 + border-right-width : 200px | |
| 38 + margin-right : -400px | |
| 39 ==================================== | |
| 40 width of containing block : 0px | |
| 41 | |
| 42 Therefore 'width: auto' must be resolved as 'width: 200px'. | |
| 43 Therefore div#child's green border-right should overlap perfectly | |
| 44 div#containing-block's red border-right. | |
| 45 */ | |
| 46 </style> | |
| 47 | |
| 48 </head> | |
| 49 | |
| 50 <body> | |
| 51 | |
| 52 <p>Test passes if there is a filled green square below and <strong>no red</str
ong>.</p> | |
| 53 | |
| 54 <div id="containing-block"> | |
| 55 <div id="child"></div> | |
| 56 </div> | |
| 57 | |
| 58 </body> | |
| 59 </html> | |
| OLD | NEW |