3 <link href=
"resources/flexbox.css" rel=
"stylesheet">
16 .flexbox :nth-child(
1) {
17 background-color: blue;
19 .flexbox :nth-child(
2) {
20 background-color: green;
22 .flexbox :nth-child(
3) {
23 background-color: red;
39 <script src=
"../../resources/check-layout.js"></script>
40 <body onload=
"checkLayout('.flexbox')">
43 <div data-expected-width=
"200" class=
"flex1"></div>
44 <div data-expected-width=
"200" class=
"flex1"></div>
45 <div data-expected-width=
"200" class=
"flex1"></div>
49 <div data-expected-width=
"200" style=
"flex: .5;"></div>
50 <div data-expected-width=
"200" style=
"flex: .5;"></div>
51 <div data-expected-width=
"200" style=
"flex: .5;"></div>
55 <div data-expected-width=
"300" class=
"flex3"></div>
56 <div data-expected-width=
"200" class=
"flex2"></div>
57 <div data-expected-width=
"100" class=
"flex1"></div>
61 <div data-expected-width=
"250" class=
"flex1"></div>
62 <div data-expected-width=
"250" class=
"flex1"></div>
63 <div data-expected-width=
"100" class=
"flex-none" style=
"width: 100px"></div>
67 <div data-expected-width=
"150" class=
"flex1"></div>
68 <div data-expected-width=
"150" class=
"flex1"></div>
69 <div data-expected-width=
"300" class=
"flex-none" style=
"width: 50%"></div>
72 <!-- The first two boxes should fill the extra 300px evenly (each gets 150px extra). -->
74 <div data-expected-width=
"150" class=
"flex1"></div>
75 <div data-expected-width=
"350" style=
"flex: 1 200px;"></div>
76 <div data-expected-width=
"100" class=
"flex-none" style=
"width: 100px"></div>
79 <!-- Like the last test, except the middle box gets more space than the first box. -->
81 <div data-expected-width=
"100" class=
"flex1"></div>
82 <div data-expected-width=
"400" style=
"flex: 2 33.333333%;"></div>
83 <div data-expected-width=
"100" class=
"flex-none" style=
"width: 100px"></div>
86 <!-- Test some negative flexing. -->
88 <div data-expected-width=
"200" style=
"flex: 1 1 300px;"></div>
89 <div data-expected-width=
"200" style=
"flex: 2 1 300px;"></div>
90 <div data-expected-width=
"200" style=
"flex: 3 1 300px;"></div>
94 <div data-expected-width=
"250" style=
"flex: 1 1 300px;"></div>
95 <div data-expected-width=
"150" style=
"flex: 2 3 300px;"></div>
96 <div data-expected-width=
"200" class=
"flex-none" style=
"width: 200px"></div>
100 <div data-expected-width=
"50" style=
"flex: 1 1 100px;"></div>
101 <div data-expected-width=
"250" style=
"flex: 1 1 500px;"></div>
102 <div data-expected-width=
"300" class=
"flex-none" style=
"width: 300px"></div>
105 <div class=
"flexbox">
106 <div data-expected-width=
"50" style=
"flex: 1 1 100px;"></div>
107 <div data-expected-width=
"250" style=
"flex: 1 1 500px; margin-right: 300px;"></div>
110 <div class=
"flexbox">
111 <div data-expected-width=
"50" style=
"flex: 1 1 100px;"></div>
112 <div data-expected-width=
"550" style=
"flex: 1 1 500px; padding-left: 300px;"></div>
115 <div class=
"flexbox">
116 <div data-expected-width=
"50" style=
"flex: 1 1 100px;"></div>
117 <div data-expected-width=
"550" style=
"flex: 1 1 500px; border-left: 200px dashed orange; border-right: 100px dashed orange;"></div>
120 <!-- Test some overflow cases. -->
121 <div class=
"flexbox">
122 <div data-expected-width=
"600" style=
"flex: 0 100000000000000000000000000000000000000 600px;"></div>
123 <div data-expected-width=
"600" style=
"flex: 0 100000000000000000000000000000000000000 600px;"></div>
126 <div class=
"flexbox">
127 <div data-expected-width=
"600" style=
"flex: 100000000000000000000000000000000000000 0 600px;"></div>
128 <div data-expected-width=
"600" style=
"flex: 0 100000000000000000000000000000000000000 600px;"></div>
129 <div data-expected-width=
"33554428" style=
"flex: 1 1 100000000000000000000000000000000000000px;"></div>
132 <!-- Test flexitem borders. -->
133 <div class=
"flexbox">
134 <div data-expected-width=
"250" class=
"flex1" style=
"border-left: 150px solid black"></div>
135 <div data-expected-width=
"250" class=
"flex1-0-0" style=
"border-right: 150px solid orange"></div>
136 <div data-expected-width=
"100" class=
"flex1-0-0"></div>
139 <div class=
"flexbox">
140 <div data-expected-width=
"300" style=
"width: 100px; border: 100px solid black; flex: none;"></div>
141 <div data-expected-width=
"200" class=
"flex2"></div>
142 <div data-expected-width=
"100" class=
"flex1"></div>
145 <!-- Test flexitem padding. -->
146 <div class=
"flexbox">
147 <div data-expected-width=
"250" class=
"flex1" style=
"padding-left: 150px"></div>
148 <div data-expected-width=
"250" class=
"flex1-0-0" style=
"padding-right: 150px"></div>
149 <div data-expected-width=
"100" class=
"flex1-0-0"></div>
152 <div class=
"flexbox">
153 <div data-expected-width=
"300" class=
"flex-none" style=
"width: 100px; padding: 100px"></div>
154 <div data-expected-width=
"200" class=
"flex2"></div>
155 <div data-expected-width=
"100" class=
"flex1"></div>
158 <div class=
"flexbox">
159 <div data-expected-width=
"200" class=
"flex1" style=
"padding-left: 25%"></div>
160 <div data-expected-width=
"150" class=
"flex3"></div>
161 <div data-expected-width=
"250" class=
"flex-none" style=
"width: 100px; padding-right: 25%"></div>
164 <div class=
"flexbox">
165 <div data-expected-width=
"200" class=
"flex1" style=
"padding-left: 50px; border-right: 50px solid black"></div>
166 <div data-expected-width=
"250" class=
"flex2" style=
"border-right: 50px solid orange"></div>
167 <div data-expected-width=
"150" class=
"flex1" style=
"padding-right: 50px;"></div>
170 <!-- Test items with an intrinsic size. -->
171 <div class=
"flexbox">
172 <div data-expected-width=
"120" class=
"flex1">
173 <div style=
"width: 100px; height: 100%;"></div>
175 <div data-expected-width=
"240" class=
"flex2"></div>
176 <div data-expected-width=
"240" class=
"flex2"></div>
179 <div class=
"flexbox">
180 <div data-expected-width=
"200" class=
"flex1-0-0">
181 <div style=
"width: 100px; height: 100%;"></div>
183 <div data-expected-width=
"200" class=
"flex1"></div>
184 <div data-expected-width=
"200" class=
"flex1"></div>
187 <div class=
"flexbox">
188 <div data-expected-width=
"200" class=
"flex-auto">
189 <div style=
"width: 100px;"></div>
191 <div data-expected-width=
"100" class=
"flex-auto"></div>
192 <div data-expected-width=
"300" class=
"flex-auto">
193 <div style=
"width: 200px;"></div>
197 <div class=
"flexbox" style=
"height: 60px; flex-flow: row wrap; position: relative;">
198 <div data-offset-x=
"0" data-offset-y=
"0" style=
"position: absolute;"></div>
199 <div data-offset-x=
"0" data-offset-y=
"0" style=
"width: 700px;"></div>
202 <!-- Test border/padding/margin on the flexbox itself. -->
203 <div data-expected-width=
"830" style=
"border: 10px solid; display: inline-block;">
204 <div data-expected-width=
"700" style=
"padding-left: 10px; padding-right: 20px; border-left: 30px solid; border-right: 40px solid; margin-left: 50px; margin-right:60px;" class=
"flexbox">
205 <div data-offset-x=
"100" data-expected-width=
"200" class=
"flex1"></div>
206 <div data-offset-x=
"300" data-expected-width=
"200" class=
"flex1"></div>
207 <div data-offset-x=
"500" data-expected-width=
"200" class=
"flex1"></div>