-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path07-flexbox.css
More file actions
244 lines (191 loc) · 3.79 KB
/
Copy path07-flexbox.css
File metadata and controls
244 lines (191 loc) · 3.79 KB
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
@charset "UTF-8";
/*
============================================================
07-flexbox.css - Flexbox工具类
功能说明:
1. 容器:flex容器、inline-flex容器
2. 方向:行、行反转、列、列反转
3. 换行:不换行、换行、换行反转
4. 主轴对齐:起始、居中、末尾、两端、环绕、均匀
5. 交叉轴对齐:起始、居中、末尾、拉伸、基线
6. 内容对齐:起始、居中、末尾、两端、环绕
7. 子项:弹性1、自动、无弹性、扩展、不收缩
8. 排序:最前、最后、第1、第2、第3
9. 自身对齐:起始、居中、末尾、拉伸
适用场景:
- 水平垂直居中布局
- 导航栏、工具栏等横向布局
- 卡片列表、栅格系统
- 响应式弹性布局
技术要点:
- 基于CSS3 Flexbox布局
- 容器属性与子项属性分离
- 支持多种对齐方式组合使用
wjs created by 2018-04-15
============================================================
*/
/* ========== 容器 ========== */
/* Flex容器 */
.flex {
display: flex;
}
/* 行内Flex容器 */
.inline-flex {
display: inline-flex;
}
/* ========== 方向 ========== */
/* 行方向(默认) */
.flex-row {
flex-direction: row;
}
/* 行反转方向 */
.flex-row-reverse {
flex-direction: row-reverse;
}
/* 列方向 */
.flex-col {
flex-direction: column;
}
/* 列反转方向 */
.flex-col-reverse {
flex-direction: column-reverse;
}
/* ========== 换行 ========== */
/* 不换行 */
.flex-nowrap {
flex-wrap: nowrap;
}
/* 换行 */
.flex-wrap {
flex-wrap: wrap;
}
/* 换行反转 */
.flex-wrap-reverse {
flex-wrap: wrap-reverse;
}
/* ========== 主轴对齐 ========== */
/* 主轴起始对齐 */
.justify-start {
justify-content: flex-start;
}
/* 主轴居中对齐 */
.justify-center {
justify-content: center;
}
/* 主轴末尾对齐 */
.justify-end {
justify-content: flex-end;
}
/* 主轴两端对齐 */
.justify-between {
justify-content: space-between;
}
/* 主轴环绕对齐 */
.justify-around {
justify-content: space-around;
}
/* 主轴均匀对齐 */
.justify-evenly {
justify-content: space-evenly;
}
/* ========== 交叉轴对齐 ========== */
/* 交叉轴起始对齐 */
.items-start {
align-items: flex-start;
}
/* 交叉轴居中对齐 */
.items-center {
align-items: center;
}
/* 交叉轴末尾对齐 */
.items-end {
align-items: flex-end;
}
/* 交叉轴拉伸对齐 */
.items-stretch {
align-items: stretch;
}
/* 交叉轴基线对齐 */
.items-baseline {
align-items: baseline;
}
/* ========== 内容对齐 ========== */
/* 内容起始对齐 */
.content-start {
align-content: flex-start;
}
/* 内容居中对齐 */
.content-center {
align-content: center;
}
/* 内容末尾对齐 */
.content-end {
align-content: flex-end;
}
/* 内容两端对齐 */
.content-between {
align-content: space-between;
}
/* 内容环绕对齐 */
.content-around {
align-content: space-around;
}
/* ========== 子项 ========== */
/* 弹性比例1 */
.flex-1 {
flex: 1;
}
/* 弹性自动 */
.flex-auto {
flex: auto;
}
/* 无弹性 */
.flex-none {
flex: none;
}
/* 允许扩展 */
.flex-grow {
flex-grow: 1;
}
/* 不收缩 */
.flex-shrink-0 {
flex-shrink: 0;
}
/* ========== 排序 ========== */
/* 最前 */
.order-first {
order: -9999;
}
/* 最后 */
.order-last {
order: 9999;
}
/* 第1个 */
.order-1 {
order: 1;
}
/* 第2个 */
.order-2 {
order: 2;
}
/* 第3个 */
.order-3 {
order: 3;
}
/* ========== 自身对齐 ========== */
/* 自身起始对齐 */
.self-start {
align-self: flex-start;
}
/* 自身居中对齐 */
.self-center {
align-self: center;
}
/* 自身末尾对齐 */
.self-end {
align-self: flex-end;
}
/* 自身拉伸对齐 */
.self-stretch {
align-self: stretch;
}