3 <link href=
"resources/flexbox.css" rel=
"stylesheet">
6 border:
2px solid orange;
20 .border-box, .flexbox
> div {
21 box-sizing: border-box;
24 border:
2px solid lightblue;
25 border-top-width:
4px;
29 <script src=
"../../resources/check-layout.js"></script>
30 <body onload=
"checkLayout('.flexbox')">
32 All blue boxes are
100x100px with box-sizing: border-box and
2px border (
4px border-top), we expect offsetWidth/Height to be
<b>100x100
</b>
34 <h3>flex-flow: default, orange box has width:
300px
</h3>
35 <div class=
"flexbox" style=
"width: 300px">
36 <div></div><div></div><div></div>
39 <h3>flex-flow: default, orange box has width:
400px
</h3>
40 <div class=
"flexbox" style=
"width: 400px">
41 <div></div><div></div><div></div>
44 <h3>flex-flow: default, orange box has width: auto
</h3>
46 <div></div><div></div><div></div>
49 <h3>flex-flow: default, orange box has width: auto, flex-box has box-sizing: border-box
</h3>
50 <div class=
"flexbox border-box">
51 <div data-expected-width=
30></div>
52 <div data-expected-width=
30></div>
53 <div data-expected-width=
30></div>
56 <h3>flex-flow: column, red box has height:
300px
</h3>
57 <div class=
"flexbox column" style=
"height: 300px">
58 <div></div><div></div><div></div>
61 <h3>flex-flow: column, red box has height:
400px
</h3>
62 <div class=
"flexbox column" style=
"height: 400px">
63 <div></div><div></div><div></div>
66 <h3>flex-flow: column, red box has height: auto
</h3>
67 <div class=
"flexbox column">
68 <div></div><div></div><div></div>
71 <h3>flex-box has box-sizing: border-box and flex-wrap: wrap;
</h3>
72 <div class=
"flexbox column wrap" style=
"box-sizing: border-box; border: 2px solid lightblue; padding: 3px; height: 200px; width: 100px; position: relative" data-expected-width=
100 data-expected-height=
200>
73 <div data-offset-x=
3></div><div data-offset-x=
103></div><div data-offset-x=
203></div>
76 <h3>flex-box has box-sizing: default and flex-wrap: wrap;
</h3>
77 <div class=
"flexbox column wrap" style=
"border: 2px solid lightblue; padding: 3px; height: 200px; width: 100px; position: relative" data-expected-width=
110 data-expected-height=
210>
78 <div data-offset-x=
3></div><div data-offset-x=
3></div><div data-offset-x=
103></div>
81 <h3>flex-flow: column, flex-box has box-sizing: border-box, flex items have flex:
1</h3>
82 <div class=
"flexbox column" style=
"box-sizing: border-box; border: 2px solid lightblue; padding: 3px; height: 343px; width: 100px;" data-expected-width=
100 data-expected-height=
343>
83 <div style=
"flex: 1;" data-expected-height=
111></div>
84 <div style=
"flex: 1;" data-expected-height=
111></div>
85 <div style=
"flex: 1;" data-expected-height=
111></div>
89 function addExpectedSizes(flexItem
) {
90 if (!flexItem
.hasAttribute('data-expected-height'))
91 flexItem
.setAttribute('data-expected-height', 100);
92 if (!flexItem
.hasAttribute('data-expected-width'))
93 flexItem
.setAttribute('data-expected-width', 100);
95 [].forEach
.call(document
.querySelectorAll(".flexbox > div"), addExpectedSizes
);
96 [].forEach
.call(document
.querySelectorAll(".border-box"), addExpectedSizes
);