| 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 - margins of a 'collapsed th
rough' box with clearance do not collapse with parent block's bottom margin</tit
le> |
| 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="bookmark" href="http://lists.w3.org/Archives/Public/public-css-test
suite/2013Oct/0009.html" title="Issue with margin-collapse-clear-012.htm and mar
gin-collapse-clear-013.htm" /> |
| 12 <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserB
ugsSection/css21testsuite/" /> |
| 13 <link rel="author" title="Bruno Fassino" href="fassino[at]gmail.com" /> |
| 14 <link rel="match" href="margin-collapse-clear-012-ref.xht" /> |
| 15 |
| 16 <meta content="When an element has had clearance applied to it and its own mar
gins collapse, these margins do not collapse with the bottom margin of the paren
t block" name="assert" /> |
| 17 <meta content="" name="flags" /> |
| 18 |
| 19 <style type="text/css"><![CDATA[ |
| 20 #rel-pos-wrapper {position: relative;} |
| 21 |
| 22 #parent-lime |
| 23 { |
| 24 background-color: lime; |
| 25 border-top: black solid 1px; |
| 26 width: 50%; |
| 27 } |
| 28 |
| 29 #float-left-blue |
| 30 { |
| 31 background-color: blue; |
| 32 float: left; |
| 33 height: 100px; |
| 34 width: 100px; |
| 35 } |
| 36 |
| 37 #clear-left |
| 38 { |
| 39 clear: left; |
| 40 margin-bottom: 140px; |
| 41 margin-top: 40px; |
| 42 } |
| 43 |
| 44 #next-yellow |
| 45 { |
| 46 background-color: yellow; |
| 47 height: 100px; |
| 48 } |
| 49 |
| 50 .ref-overlapped-red |
| 51 { |
| 52 background-color: red; |
| 53 position: absolute; |
| 54 z-index: -1; |
| 55 } |
| 56 |
| 57 #ref1 |
| 58 { |
| 59 height: 200px; |
| 60 top: 1px; |
| 61 width: 50%; |
| 62 } |
| 63 |
| 64 #ref2 |
| 65 { |
| 66 height: 100px; |
| 67 top: 201px; |
| 68 width: 100%; |
| 69 } |
| 70 ]]></style> |
| 71 |
| 72 </head> |
| 73 |
| 74 <body> |
| 75 |
| 76 <p>Test passes if there is <strong>no red</strong>.</p> |
| 77 |
| 78 <div id="rel-pos-wrapper"> |
| 79 |
| 80 <!-- |
| 81 |
| 82 clearance |
| 83 + |
| 84 margin-top of #clear-left (40px) |
| 85 ==================================== |
| 86 height of #float-left-blue (100px) |
| 87 |
| 88 therefore, clearance is equal to +60px |
| 89 |
| 90 --> |
| 91 |
| 92 <!-- |
| 93 |
| 94 #parent-lime should have height 200px, sum of: |
| 95 |
| 96 100px : height of #float-left-blue |
| 97 + |
| 98 (140px - 40px) : part of #clear-left's margin-bottom |
| 99 exceeding #clear-left's margin-top |
| 100 ======= |
| 101 200px |
| 102 |
| 103 The position of the top border edge of the div#clear-left |
| 104 is where it would have been if the element had a |
| 105 non-zero bottom border. The margins of div#clear-left |
| 106 collapse together to 140px and the top border edge of |
| 107 div#clear-left is at 40px inside of it. Clearance is |
| 108 added at such position, not to the whole 140px. |
| 109 |
| 110 Issue with margin-collapse-clear-012.htm and margin-collapse-clear-013.htm |
| 111 http://lists.w3.org/Archives/Public/public-css-testsuite/2013Oct/0012.html |
| 112 |
| 113 --> |
| 114 |
| 115 <div id="parent-lime"> |
| 116 <div id="float-left-blue"></div> |
| 117 <div id="clear-left"></div> |
| 118 </div> |
| 119 |
| 120 <!-- |
| 121 #next-yellow should immediately follow #parent-lime (no margins in between) |
| 122 --> |
| 123 |
| 124 <div id="next-yellow"></div> |
| 125 |
| 126 <!-- |
| 127 #ref1 and #ref2 boxes create a sort of 'reference rendering' |
| 128 where #ref1 should be covered, overlapped by #parent-lime |
| 129 while #ref2 should be covered, overlapped by #next-yellow. |
| 130 --> |
| 131 |
| 132 <div id="ref1" class="ref-overlapped-red"></div> |
| 133 <div id="ref2" class="ref-overlapped-red"></div> |
| 134 |
| 135 </div> |
| 136 |
| 137 </body> |
| 138 </html> |
| OLD | NEW |