1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3
4 <head>
5
6 <title>CSS Test: Collapsing margins - margin-bottom of the last in-flow child block collapsing with its max-height parent block's bottom margin</title>
7
8 <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
9 <link rel="author" title="Bruno Fassino" href="fassino[at]gmail.com">
10 <link rel="help" href="http://www.w3.org/TR/CSS21/changes.html#q313">
11 <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins">
12 <meta content="" name="flags">
13 <meta content="The 'max-height' of a parent block element should have no influence over whether such parent block element's bottom margin is adjoining to its last child's bottom margin. In such situation, the bottom margin of the parent block element and the bottom margin of its last child should collapse as long as such parent block element has no bottom padding and has no bottom border." name="assert">
14
15 <style type="text/css">
16 body {margin: 8px;}
17
18 p {margin: 8px 0px 0px;}
19
20 div#reference-overlapped-red
21 {
22 background-color: red;
23 height: 200px;
24 left: 8px;
25 position: absolute;
26 right: 8px;
27 z-index: -1;
28 }
29
30 div#green-grand-parent
31 {
32 background-color: green;
33 border-bottom: green solid 1px;
34 }
35
36 div#parent-with-max-height
37 {
38 margin-bottom: 0px;
39 max-height: 99px;
40 }
41
42 div#last-child
43 {
44 height: 300px; /* the height of parent-with-max-height is constrained by its max-height which is smaller than this last-child height */
45 margin-bottom: 100px;
46 }
47 </style>
48
49 </head>
50
51 <body>
52
53 <p>There should be a tall filled green rectangle across the page and <strong>no red</strong>.</p>
54
55 <div id="reference-overlapped-red"></div>
56
57 <div id="green-grand-parent">
58 <div id="parent-with-max-height">
59 <div id="last-child"></div>
60 </div>
61 </div>
62
63 <!--
64 #last-child's margin-bottom should collapse with #parent-with-max-height's margin-bottom: max(0px, 100px) = 100px
65 -->
66
67 </body>
68 </html>