multicol-nested-margin-003

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 a top margin set on the first child element of a nested multicol element will not collapse with the margins of the multicol element.

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-003-ref.htm">
 9   <meta name="flags" content="ahem">
10   <meta name="assert" content="This test checks that a top margin set on the first child element of a nested multicol element will not collapse with the margins of the multicol element.">
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-color: yellow;
25   color: black;
26   margin: 1em 1em 0;
27   orphans: 1;
28   widows: 1;
29 
30   column-count: 3;
31   column-gap: 1em;
32   }
33 
34   /*
35 
36   N == 3;
37 
38   43em - 2em (horizontal margins) == available-width
39 
40   W == max(0, (available-width - ((N - 1) * column-gap)) / N);
41   W == max(0, (41em - ((3 - 1) * 1em)) / 3);
42   W == max(0, (41em - (2 * 1em)) / 3);
43   W == max(0, (41em - 2em) / 3);
44   W == max(0, 39em / 3);
45   W == max(0, 13em);
46   W == 13em;
47 
48     13em : width of each outer column box
49    -
50      2em : horizontal margin of each div inside
51    =======
52     11em : width of each inner multi-column elements
53 
54   N == 3;
55 
56   W == max(0, (available-width - ((N - 1) * column-gap)) / N);
57   W == max(0, (11em - ((3 - 1) * 1em)) / 3);
58   W == max(0, (11em - (2 * 1em)) / 3);
59   W == max(0, (11em - 2em) / 3);
60   W == max(0, 9em / 3);
61   W == max(0, 3em);
62   W == 3em;
63 
64   */
65 
66   div div:nth-child(2) {color: pink;}
67 
68   div div:nth-child(3) {color: blue;}
69   </style>
70  </head>
71 
72  <body>
73 
74   <div>
75 	<div>
76 		bl ac
77 		bl ac
78 		bl ac
79 		bl ac
80 	</div>
81 	<div>
82 		Pi nk
83 		Pi nk
84 		Pi nk
85 		Pi nk
86 	</div>
87 	<div>
88 		bl ue
89 		bl ue
90 		bl ue
91 		bl ue
92 	</div>
93   </div>
94 
95  </body>
96 </html>