summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/css3/flexbox/flex-justify-content.html
blob: f25900bc41576780182ce024114f478e72170223 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<!DOCTYPE html>
<html>
<style>
body {
    margin: 0;
}
.flexbox {
    width: 600px;
    display: -webkit-flex;
    background-color: #aaa;
    position: relative;
}
.flexbox div {
    height: 20px;
    border: 0;
    -webkit-flex: none;
}

.flexbox :nth-child(1) {
    background-color: blue;
}
.flexbox :nth-child(2) {
    background-color: green;
}
.flexbox :nth-child(3) {
    background-color: red;
}
</style>
<script src="../../resources/check-layout.js"></script>
<body onload="checkLayout('.flexbox')">
<div class="flexbox">
  <div data-expected-width="100" data-offset-x="0" style="-webkit-flex: 1 0 0; max-width: 100px;"></div>
  <div data-expected-width="100" data-offset-x="100" style="width: 100px;"></div>
  <div data-expected-width="100" data-offset-x="200" style="width: 100px;"></div>
</div>

<div class="flexbox" style="-webkit-justify-content: flex-end">
  <div data-expected-width="100" data-offset-x="300" style="-webkit-flex: 0 0 100px;"></div>
  <div data-expected-width="100" data-offset-x="400" style="width: 100px;"></div>
  <div data-expected-width="100" data-offset-x="500" style="width: 100px;"></div>
</div>

<div class="flexbox" style="-webkit-justify-content: center">
  <div data-expected-width="100" data-offset-x="150" style="-webkit-flex: 1 0 0; max-width: 100px;"></div>
  <div data-expected-width="100" data-offset-x="250" style="width: 100px;"></div>
  <div data-expected-width="100" data-offset-x="350" style="width: 100px;"></div>
</div>

<div class="flexbox" style="-webkit-justify-content: center">
  <div data-expected-width="200" data-offset-x="0" style="-webkit-flex: 1 100px;"></div>
  <div data-expected-width="200" data-offset-x="200" style="-webkit-flex: 1 100px;"></div>
  <div data-expected-width="200" data-offset-x="400" style="-webkit-flex: 1 100px;"></div>
</div>

<!-- True centering on overflow. -->
<div class="flexbox" style="-webkit-justify-content: center">
  <div data-expected-width="800" data-offset-x="-100" style="width: 800px;"></div>
</div>

<div class="flexbox" style="-webkit-justify-content: space-between">
  <div data-expected-width="100" data-offset-x="0" style="-webkit-flex: 1 0 0; max-width: 100px;"></div>
  <div data-expected-width="100" data-offset-x="250" style="width: 100px;"></div>
  <div data-expected-width="100" data-offset-x="500" style="width: 100px;"></div>
</div>

<div class="flexbox" style="-webkit-justify-content: space-between">
  <div data-expected-width="200" data-offset-x="0" style="-webkit-flex: 1 100px;"></div>
  <div data-expected-width="200" data-offset-x="200" style="-webkit-flex: 1 100px;"></div>
  <div data-expected-width="200" data-offset-x="400" style="-webkit-flex: 1 100px;"></div>
</div>

<!-- If there's only one child, we justify-content: flex-start. -->
<div class="flexbox" style="-webkit-justify-content: space-between">
  <div data-expected-width="100" data-offset-x="0" style="-webkit-flex: 1 0 0; max-width: 100px;"></div>
</div>

<div class="flexbox" style="-webkit-justify-content: space-around">
  <div data-expected-width="100" data-offset-x="50" style="-webkit-flex: 1 0 0; max-width: 100px;"></div>
  <div data-expected-width="100" data-offset-x="250" style="width: 100px;"></div>
  <div data-expected-width="100" data-offset-x="450" style="width: 100px;"></div>
</div>

<!-- If there's only one child, we justify-content center. -->
<div class="flexbox" style="-webkit-justify-content: space-around">
  <div data-expected-width="100" data-offset-x="250" style="-webkit-flex: 1 0 0; max-width: 100px;"></div>
</div>

<!-- True centering on overflow. -->
<div class="flexbox" style="-webkit-justify-content: space-around">
  <div data-expected-width="800" data-offset-x="-100" style="width: 800px;"></div>
</div>

<!-- Make sure we don't crash with no children. -->
<div class="flexbox" style="-webkit-justify-content: space-around"></div>

<!-- margin:auto applies before justify-content. -->
<div class="flexbox" style="-webkit-justify-content: flex-end">
  <div data-expected-width="100" data-offset-x="0" style="width: 100px;"></div>
  <div data-expected-width="100" data-offset-x="100" style="width: 100px; margin-right: auto"></div>
  <div data-expected-width="100" data-offset-x="500" style="width: 100px;"></div>
</div>

<!-- The justify-content does nothing here because we are shrinking. -->
<div class="flexbox" style="-webkit-justify-content: flex-end">
  <div data-expected-width="200" data-offset-x="0" style="-webkit-flex: 0 1 300px;"></div>
  <div data-expected-width="200" data-offset-x="200" style="width: 200px;"></div>
  <div data-expected-width="200" data-offset-x="400" style="width: 200px;"></div>
</div>

<!-- We overflow the flexbox (no negative flexing) and align the end. The overflow is to the left. -->
<div class="flexbox" style="-webkit-justify-content: flex-end">
  <div data-expected-width="300" data-offset-x="-100" style="-webkit-flex: 1 0 300px;"></div>
  <div data-expected-width="200" data-offset-x="200" style="width: 200px;"></div>
  <div data-expected-width="200" data-offset-x="400" style="width: 200px;"></div>
</div>

</body>
</html>