1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
6 <title>CSS Test: Margin collapsing - margins of a 'collapsed through' box without clearance can 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=
"author" title=
"GĂ©rard Talbot" href=
"http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
10 <link rel=
"author" title=
"Daniel Schattenkirchner" href=
"crazy-daniel{at}gmx.de">
11 <link rel=
"match" href=
"margin-collapse-clear-017-ref.htm">
13 <meta content=
"An element that does not have clearance applied to it can collapse its top margin with its parent block's bottom margin. Margins of a 'collapsed through' box without clearance applied to it can collapse with its parent block's bottom margin. An element with 'clear' set to a value other than 'none' can create a clearance only if and only when there is an earlier (in the source document) floating box." name=
"assert">
14 <meta content=
"image" name=
"flags">
16 <style type=
"text/css">
19 background: white url
("support/ruler-v-100px-200px-300px.png") no-repeat
;
20 margin: 34px 8px 8px 55px;
22 34px : body's top margin collapsing with p's top margin: max(34px, 16px)
23 + 20px : p's 1st line box height
24 + 20px : p's 2nd line box height
25 + 16px : p's bottom margin
26 + 10px : height of topmost green bar
39 div#parent-block
{margin-bottom: 100px;}
41 div
.vertical-gap-separator
43 background-color: green
;
47 div#element-without-clearance
54 In this test, div#element-without-clearance
55 is what the spec refers to as
56 'collapsed through' box
57 http://www.w3.org/TR/CSS21/box.html#collapsed-through
65 <p>Test passes if there is a vertical gap
<br>
66 of exactly
100px between
2 green bars.
</p>
68 <div id=
"parent-block">
69 <div class=
"vertical-gap-separator"></div>
70 <div id=
"element-without-clearance"></div>
73 <div class=
"vertical-gap-separator"></div>
76 div#element-without-clearance's margin-top should collapse
77 with #parent-block's margin-bottom: max(100px, 100px) = 100px