-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
314 lines (311 loc) · 12.7 KB
/
index.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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>CSS Flexible Box Layout Cheat Sheet</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:400,100,300,500,700,900,100italic,300italic,400italic,500italic,700italic,900italic">
<link rel="stylesheet/less" href="index.less">
</head>
<body>
<header>
<h1>CSS Flexible Box Layout Cheat Sheet</h1>
<h5>
<a href="https://drafts.csswg.org/css-flexbox/">W3C Candidate Recommendation — January 2016</a>
</h5>
<h5>Flexbox - A new layout mode in CSS: layouts without tables, floats, position, or inline-blocks.</h5>
</header>
<main>
<section>
<header>
<h1>Flex Container</h1>
<p>A container holding flex items. Declared by setting the display property to <code>flex</code> or <code>inline-flex</code>.
Example — <code class="em">display: flex;</code></p>
</header>
<section>
<h1>Properties</h1>
<dl>
<dt>flex-direction</dt>
<dd>items direction on the flex line <b>||</b> main axis</dd>
<ul>
<li class="default">row</li>
<li>row-reverse</li>
</ul>
<ul>
<li>column</li>
<li>column-reverse</li>
</ul>
</dl>
<dl>
<dt>flex-wrap</dt>
<dd>when needed, wraps items onto a new flex line</dd>
<ul>
<li class="default">no-wrap</li>
</ul>
<ul>
<li>wrap</li>
<li>wrap-reverse</li>
</ul>
</dl>
<dl>
<dt>justify-content</dt>
<dd>item's position on the flex line <b>||</b> main axis</dd>
<ul>
<li class="default">flex-start</li>
<li>flex-end</li>
</ul>
<ul>
<li>center</li>
</ul>
<ul>
<li>space-between</li>
<li>space-around</li>
</ul>
</dl>
<dl>
<dt>align-content</dt>
<dd>flex lines' position <b>⊥</b> main axis, 2+ flex lines</dd>
<ul>
<li class="default">stretch</li>
</ul>
<ul>
<li>flex-start</li>
<li>flex-end</li>
</ul>
<ul>
<li>center</li>
</ul>
<ul>
<li>space-between</li>
<li>space-around</li>
</ul>
</dl>
<dl>
<dt>align-items</dt>
<dd>item's position on the flex line <b>⊥</b> main axis</dd>
<ul>
<li class="default">stretch</li>
</ul>
<ul>
<li>flex-start</li>
<li>flex-end</li>
</ul>
<ul>
<li>center</li>
</ul>
<ul>
<li>baseline</li>
</ul>
</dl>
<dl>
<dt>flex-flow</dt>
<dd>shorthand for flex-direction and flex-wrap</dd>
<dd class="no-caps"><code>flex-flow: {flex-direction} {flex-wrap};</code></dd>
<ul>
<li class="default">row</li>
<li class="default">no-wrap</li>
</ul>
</dl>
</section>
<footer>
<p><b>⊥</b> main axis == <b>||</b> cross axis</p>
<p class="default">indicates default value</p>
<section>
<div>
<div class="vertical-left-center">
<span>Main Start</span>
</div>
<div>
<div>Cross Start</div>
<div class="grid">
<div>
<span>Flex Line</span>
</div>
<div></div>
</div>
<div class="grid">
<div></div>
<div>
<span>
Main Direction →
<br>
Main Axis
</span>
</div>
</div>
<div class="grid">
<div></div>
<div class="vertical-right-left">
<span>
← Cross Size →
<br>
Cross Direction →
<br>
Cross Axis
</span>
</div>
</div>
<div>Cross End</div>
</div>
<div class="vertical-right-center">
<span>Main End</span>
</div>
</div>
</section>
</footer>
</section>
<section>
<header>
<h1>Flex Item</h1>
<p>The immediate children of a flex container. Positioned along a flex line. Direction depends on the writing
mode. Example — <code class="em">flex: auto;</code></p>
</header>
<section>
<h1>Properties</h1>
<dl>
<dt>flex</dt>
<dd>
how extra space is distributed along the flex line <b>||</b> main axis
</dd>
<dd>
in the form of <code>flex: {grow} {shrink} {basis};</code>
</dd>
<dd class="no-caps">
<code>{grow}</code> and <code>{shrink}</code> must be positive number values</code>
</dd>
<ul>
<li>
<dl>
<dt class="default">initial</dt>
<dd>inflexibly grow, flexibly shrink, auto basis</dd>
<dd class="no-caps"><code>flex: 0 1 auto;</code></dd>
</dl>
</li>
</ul>
<ul>
<li>
<dl>
<dt>auto</dt>
<dd>fully flexible, auto basis</dd>
<dd class="no-caps"><code>flex: 1 1 auto;</code></dd>
</dl>
</li>
</ul>
<ul>
<li>
<dl>
<dt>none</dt>
<dd>fully inflexible, auto basis</dd>
<dd class="no-caps"><code>flex: 0 0 auto;</code></dd>
</dl>
</li>
</ul>
<ul>
<li>
<dl>
<dt>{number}</dt>
<dd class="no-caps">number for grow, flexible shrink, 0% basis</dd>
<dd class="no-caps"><code>flex: {number} 1 0%;</code></dd>
</dl>
</li>
</ul>
<ul>
<li>
<dl>
<dt>{number-a} {number-b}</dt>
<dd class="no-caps">number-a for grow, number-b for shrink, 0% basis</dd>
<dd class="no-caps"><code>flex: {number-a} {number-b} 0%;</code></dd>
</dl>
</li>
</ul>
<ul>
<li>
<dl>
<dt>{number-a} {number-b} {value}</dt>
<dd class="no-caps">number-a for grow, number-b for shrink, value for basis</dd>
<dd class="no-caps"><code>flex: {number-a} {number-b} {value};</code></dd>
</dl>
</li>
</ul>
</dl>
<dl>
<dt>align-self</dt>
<dd>overrides container <span class="container-prop">align-items</span> property</dd>
<ul>
<li class="default">auto</li>
</ul>
<ul>
<li>stretch</li>
</ul>
<ul>
<li>flex-start</li>
<li>flex-end</li>
</ul>
<ul>
<li>center</li>
</ul>
<ul>
<li>baseline</li>
</ul>
</dl>
<dl>
<dt>order</dt>
<dd>item's order relative to other sibling items</dd>
<dd>any positive or negative integer</dd>
<ul>
<li class="default">0</li>
</ul>
</dl>
<dl>
<dt>margin</dt>
<dd>not specific to flex items</dd>
<ul>
<li class="default">0</li>
</ul>
<ul>
<li>
<dl>
<dt>auto</dt>
<dd>a quick way to center an item along both axes</dd>
</dl>
</li>
</ul>
</dl>
<dl>
<dt>visibility</dt>
<dd>changes the behavior of the cross size rendering</dd>
<dd>not specific to flex items</dd>
<ul>
<li class="default">visible</li>
</ul>
<ul>
<li>
<dl>
<dt>collapse</dt>
<dd>keeps the cross size as if the item were visible but does not render the item</dd>
</dl>
</li>
</ul>
<ul>
<li>
<dl>
<dt>hidden</dt>
<dd>does not keep the cross size as if the item were visible and does not render the item</dd>
</dl>
</li>
</ul>
</dl>
</section>
<footer>
<p class="default">indicates default value</p>
</footer>
</section>
</main>
<footer>
<p>Thanks to the article at <a href="https://bocoup.com/weblog/dive-into-flexbox">bocoup</a> for inspiring the initial
draft of this cheat sheet; however, things have changed since that first draft way back in 2013. Summerized by
<a href="https://github.com/coderfin">coderfin</a>. © 2016</p>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/less.js/2.6.0/less.min.js"></script>
</body>
</html>