| 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: Margin collapsing with clearance - clearance may be negative<
/title> |
| 8 |
| 9 <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins"
/> |
| 10 <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#normal-block" /
> |
| 11 <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserB
ugsSection/css21testsuite/" /> |
| 12 <link rel="author" title="Bruno Fassino" href="fassino[at]gmail.com" /> |
| 13 <link rel="match" href="margin-collapse-clear-014-ref.xht" /> |
| 14 |
| 15 <meta content="Clearance is created above the top margin of the element with c
lear set. Clearance can be negative. Clearance stops the collapsing of the eleme
nt's margins with the preceding siblings' margins and with the parent block's bo
ttom margin." name="assert" /> |
| 16 <meta content="" name="flags" /> |
| 17 |
| 18 <style type="text/css"><![CDATA[ |
| 19 #rel-pos-wrapper {position: relative;} |
| 20 |
| 21 #parent-lime |
| 22 { |
| 23 background-color: lime; |
| 24 width: 50%; |
| 25 } |
| 26 |
| 27 #preceding-sibling-aqua |
| 28 { |
| 29 background-color: aqua; |
| 30 height: 60px; |
| 31 margin-bottom: 40px; |
| 32 } |
| 33 |
| 34 #float-left-blue |
| 35 { |
| 36 background-color: blue; |
| 37 float: left; |
| 38 height: 100px; |
| 39 width: 100px; |
| 40 } |
| 41 |
| 42 #clear-left |
| 43 { |
| 44 clear: left; |
| 45 margin-top: 120px; |
| 46 } |
| 47 |
| 48 #next-yellow |
| 49 { |
| 50 background-color: yellow; |
| 51 height: 100px; |
| 52 } |
| 53 |
| 54 .ref-overlapped-red |
| 55 { |
| 56 background-color: red; |
| 57 position: absolute; |
| 58 z-index: -1; |
| 59 } |
| 60 |
| 61 #ref1 |
| 62 { |
| 63 height: 200px; |
| 64 top: 0px; |
| 65 width: 50%; |
| 66 } |
| 67 |
| 68 #ref2 |
| 69 { |
| 70 height: 100px; |
| 71 top: 200px; |
| 72 width: 100%; |
| 73 } |
| 74 ]]></style> |
| 75 |
| 76 </head> |
| 77 |
| 78 <body> |
| 79 |
| 80 <p>Test passes if there is <strong>no red</strong>.</p> |
| 81 |
| 82 <div id="rel-pos-wrapper"> |
| 83 |
| 84 <!-- |
| 85 |
| 86 #parent-lime should have height 200px, sum of: |
| 87 |
| 88 60px : height of #preceding-sibling-aqua |
| 89 + |
| 90 40px : margin-bottom of #preceding-sibling-aqua |
| 91 + |
| 92 100px : height of #float-left-blue |
| 93 ===================================================== |
| 94 200px |
| 95 |
| 96 --> |
| 97 |
| 98 <div id="parent-lime"> |
| 99 <div id="preceding-sibling-aqua"></div> |
| 100 <div id="float-left-blue"></div> |
| 101 <div id="clear-left"></div> |
| 102 </div> |
| 103 |
| 104 <!-- |
| 105 |
| 106 clearance |
| 107 + |
| 108 margin-top of #clear-left (120px) |
| 109 ==================================== |
| 110 height of #float-left-blue (100px) |
| 111 |
| 112 therefore, clearance is equal to -20px |
| 113 |
| 114 --> |
| 115 |
| 116 <div id="next-yellow"></div> |
| 117 |
| 118 <!-- |
| 119 #ref1 and #ref2 boxes create a sort of 'reference rendering' |
| 120 where #ref1 should be covered, overlapped by #parent-lime |
| 121 while #ref2 should be covered, overlapped by #next-yellow. |
| 122 --> |
| 123 |
| 124 <div id="ref1" class="ref-overlapped-red"></div> |
| 125 <div id="ref2" class="ref-overlapped-red"></div> |
| 126 |
| 127 </div> |
| 128 |
| 129 </body> |
| 130 </html> |
| OLD | NEW |