-
Notifications
You must be signed in to change notification settings - Fork 0
/
flexbox3.html
200 lines (169 loc) · 3.88 KB
/
flexbox3.html
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Flexbox by trial</title>
<style>
.container {
margin: 0.5em 3em;
background-color: #E6E3D4;
border: 2px solid #42659A;
display:-webkit-flex;
display: flex;
}
.box {
border: 2px solid #42659A;
padding: 5px;
margin: 2px;
background: #77A0B8;
color: #fff;
}
.flex-container-two {
-webkit-flex-flow: row-reverse;
flex-flow: row-reverse;
webkit-justify-content: flex-end;
justify-content: flex-end;
}
.flex-container-one .box1{
-webkit-order: 2;
order: 2;
}
.flex-container-one .box2{
-webkit-order: -100;
order: -100;
}
.flex-container-one .box3,
.flex-container-one .box4{
-webkit-order: 3;
order: 3;
}
.flex-container-three .box1{
-webkit-order: 4;
order: 4;
}
.flex-container-three .box2{
-webkit-order: 3;
order: 3;
}
.flex-container-three .box3 {
order: 2;
}
.flex-container-three .box4 {
-webkit-order: 1;
order: 1;
}
.flex-container-five {
display:-webkit-flex;
display: flex;
-webkit-flex-flow: column;
flex-flow: column;
}
.flex-container-five .box5-3 {
order: -1;
}
</style>
</head>
<body>
<header>
<h1>Flexbox by trial. Part 3. Order! Order!</h1>
<p>
Flexbox is CSS3 for laying out elements.
Check browser <a href="http://caniuse.com/#feat=flexbox">support info (by caniuse.com)</a>
</p>
</header>
<article>
<h2>Order</h2>
<p>Order is set on an element in the flex container. It can be negative (-500 to make sure it's first element).
If order value is the same on all elements, source order takes charge.
</p>
<pre>
.class {
-webkit-order: 2;
order: 2;
}
</pre>
<section class="container flex-container-one">
<div class="box box1">
<h3>one</h3>
</div>
<div class="box box2">
<h3>two</h3>
</div>
<div class="box box3">
<h3>three</h3>
</div>
<div class="box box4">
<h3>four</h3>
</div>
</section>
</article>
<article>
<h2>Order vs flex-flow/justify-content</h2>
<p>Order is set on an element in the flex container. Flex-flow/justify-content is set on flex container to control layout items inside.
</p>
<h3>Reverse order with flex-flow/justify-content</h3>
<section class="container flex-container-two">
<div class="box box1">
<h3>one</h3>
</div>
<div class="box box2">
<h3>two</h3>
</div>
<div class="box box3">
<h3>three</h3>
</div>
<div class="box box4">
<h3>four</h3>
</div>
</section>
<h3>Reverse order with order</h3>
<section class="container flex-container-three">
<div class="box box1">
<h3>one</h3>
</div>
<div class="box box2">
<h3>two</h3>
</div>
<div class="box box3">
<h3>three</h3>
</div>
<div class="box box4">
<h3>four</h3>
</div>
</section>
</article>
<article>
<h2>Nested elements</h2>
<p>Each flex container has it's own order, doesn't inherit from parent or influenced by child containers.
</p>
<h3>Reverse order with flex-flow/justify-content</h3>
<section class="container flex-container-four">
<div class="box box1">
<h3>one</h3>
</div>
<div class="box box2">
<h3>two</h3>
</div>
<div class="box box3">
<div class="container flex-container-five">
<div class="box box5-1">
<h3>ONE</h3>
</div>
<div class="box box5-2">
<h3>TWO</h3>
</div>
<div class="box box5-3">
<h3>THREE</h3>
</div>
<div class="box box5-4">
<h3>FOUR</h3>
</div>
</div>
</div>
<div class="box box4">
<h3>four</h3>
</div>
</section>
</article>
</body>
</html>