1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <title>CSS Multi-column Layout Test: nested multicolumn and nested margin-top</title>
5 <link rel="author" title="Opera Software ASA" href="http://www.opera.com/">
6 <link rel="reviewer" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/"> <!-- 2013-08-14 -->
7 <link rel="help" href="http://www.w3.org/TR/css3-multicol/#the-multi-column-model" title="2. The multi-column model">
8 <link rel="match" href="reference/multicol-nested-margin-004-ref.htm">
9 <meta name="flags" content="ahem">
10 <meta name="assert" content="This test checks that due to a top margin only set on the first child element of a nested multicol element that will not collapse with the margins of the multicol element, then the height of an multi-column element can make its other inner multi-column (with a zero margin-top) element break into its own column boxes.">
11 <style type="text/css">
12 body > div
13 {
14 font: 1.25em/1 Ahem;
15 margin: 1em;
16 width: 41em;
17 /*
18 This test requires a viewport width of 860px
19 */
20 }
21
22 div
23 {
24 background: yellow;
25 color: black;
26 margin: 1em;
27 orphans: 1;
28 widows: 1;
29
30 column-count: 3;
31 column-gap: 1em;
32 }
33
34 div div {margin: 0 1em;}
35
36 div div:first-child {margin: 1em 1em 0;}
37
38 /*
39
40 N == 3;
41
42 43em - 2em (horizontal margins) == available-width
43
44 W == max(0, (available-width - ((N - 1) * column-gap)) / N);
45 W == max(0, (41em - ((3 - 1) * 1em)) / 3);
46 W == max(0, (41em - (2 * 1em)) / 3);
47 W == max(0, (41em - 2em) / 3);
48 W == max(0, 39em / 3);
49 W == max(0, 13em);
50 W == 13em;
51
52 13em : width of each outer column box
53 -
54 2em : horizontal margin of each div inside
55 =======
56 11em : width of each inner multi-column elements
57
58 N == 3;
59
60 W == max(0, (available-width - ((N - 1) * column-gap)) / N);
61 W == max(0, (11em - ((3 - 1) * 1em)) / 3);
62 W == max(0, (11em - (2 * 1em)) / 3);
63 W == max(0, (11em - 2em) / 3);
64 W == max(0, 9em / 3);
65 W == max(0, 3em);
66 W == 3em;
67
68 */
69
70 div div:nth-child(2) {color: pink;}
71
72 div div:nth-child(3) {color: blue;}
73 </style>
74 </head>
75
76 <body>
77
78 <div>
79 <div>
80 bl ac
81 bl ac
82 bl ac
83 bl ac
84 </div>
85 <div>
86 Pi nk
87 Pi nk
88 Pi nk
89 Pi nk
90 </div>
91 <div>
92 bl ue
93 bl ue
94 bl ue
95 bl ue
96 </div>
97 </div>
98
99 </body>
100 </html>