multicol-nested-margin-005

nested multicolumn and nested margin-top

WeasyPrint

Reference (good) by WeasyPrint

Reference (good) by this browser

This browser

Flags
ahem
Assertion
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.

Source

 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 1em 0em;
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   W == max(0, (available-width - ((N - 1) * column-gap)) / N);
43   W == max(0, (41em - ((3 - 1) * 1em)) / 3);
44   W == max(0, (41em - (2 * 1em)) / 3);
45   W == max(0, (41em - 2em) / 3);
46   W == max(0, 39em / 3);
47   W == max(0, 13em);
48   W == 13em;
49 
50     13em : width of each outer column box
51    -
52      2em : horizontal margin of each div inside
53    =======
54     11em : width of each inner multi-column elements
55 
56   N == 3;
57 
58   W == max(0, (available-width - ((N - 1) * column-gap)) / N);
59   W == max(0, (11em - ((3 - 1) * 1em)) / 3);
60   W == max(0, (11em - (2 * 1em)) / 3);
61   W == max(0, (11em - 2em) / 3);
62   W == max(0, 9em / 3);
63   W == max(0, 3em);
64   W == 3em;
65 
66   */
67 
68   div div:nth-child(2) {color: pink;}
69 
70   div div:nth-child(3) {color: blue;}
71   </style>
72  </head>
73 
74  <body>
75 
76   <div>
77 	<div>
78 		bl ac
79 		bl ac
80 		bl ac
81 		bl ac
82 	</div>
83 	<div>
84 		Pi nk
85 		Pi nk
86 		Pi nk
87 		Pi nk
88 	</div>
89 	<div>
90 		bl ue
91 		bl ue
92 		bl ue
93 		bl ue
94 	</div>
95   </div>
96 
97  </body>
98 </html>