1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
6 <title>CSS Test: Margin collapsing with clearance - margins of a 'collapsed through' box with clearance do not collapse with parent block's bottom margin
</title>
8 <link rel=
"help" href=
"http://www.w3.org/TR/CSS21/box.html#collapsing-margins">
9 <link rel=
"help" href=
"http://www.w3.org/TR/CSS21/visudet.html#normal-block">
10 <link rel=
"author" title=
"GĂ©rard Talbot" href=
"http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
11 <link rel=
"author" title=
"Bruno Fassino" href=
"fassino[at]gmail.com">
12 <link rel=
"match" href=
"margin-collapse-clear-012-ref.htm">
14 <meta content=
"When an element has had clearance applied to it and its own margins collapse, these margins collapse with the adjoining margins of following siblings but the resulting margin does not collapse with the bottom margin of the parent block" name=
"assert">
15 <meta content=
"" name=
"flags">
17 <style type=
"text/css">
18 #rel-pos-wrapper {position: relative
;}
22 background-color: lime
;
23 border-top: black solid
1px;
29 background-color: blue
;
42 #following-sibling {margin-bottom: 140px;}
46 background-color: yellow
;
52 background-color: red
;
76 <p>Test passes if there is
<strong>no red
</strong>.
</p>
78 <div id=
"rel-pos-wrapper">
82 #parent-lime should have height 200px, sum of:
84 100px : height of #float-left-blue
86 (140px - 40px) : part of #following-sibling's margin-bottom
87 "exceeding" the amount collapsed with
88 #clear-left's margin-top (140px - 40px)
94 <div id=
"parent-lime">
95 <div id=
"float-left-blue"></div>
96 <div id=
"clear-left"></div>
102 margin-top of #clear-left (40px)
103 ====================================
104 height of #float-left-blue (100px)
106 therefore, clearance is equal to +60px
110 <div id=
"following-sibling"></div>
113 <div id=
"next-yellow"></div>
116 #ref1 and #ref2 boxes create a sort of 'reference rendering'
117 where #ref1 should be covered, overlapped by #parent-lime
118 while #ref2 should be covered, overlapped by #next-yellow.
121 <div id=
"ref1" class=
"ref-overlapped-red"></div>
122 <div id=
"ref2" class=
"ref-overlapped-red"></div>