-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflex布局.html
135 lines (134 loc) · 2.21 KB
/
flex布局.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>flex布局</title>
<style>
section {
margin: 10px 0;
}
section h3 {
padding: 10px 0;
}
body {
padding: 10px 20px;
font: 14px/1.5 "微软雅黑";
}
* {
margin: 0;
padding: 0;
}
.w300 {
width: 300px;
}
.w500 {
width: 500px;
}
.flex-box {
display: flex;
border: 2px solid #000;
}
.flex-box div, .flex-box span {
width: 200px;
color: #fff;
font-size: 20px;
background-color: red;
}
.flex-box.row {
flex-direction: row;
}
.flex-box.row-reverse {
flex-direction: row-reverse;
}
.flex-box.column {
flex-direction: column;
}
.flex-box.column-reverse {
flex-direction: column-reverse;
}
.flex-box.nowrap {
flex-wrap: nowrap;
}
.flex-box.wrap {
flex-wrap: wrap;
}
.flex-box.wrap-reverse {
flex-wrap: wrap-reverse;
}
</style>
</head>
<body>
<section>
<h3> flex </h3>
<div class="flex-box">
<div>1</div>
<span>2</span>
<div>3</div>
<span>4</span>
</div>
</section>
<section>
<h3> flex.row(default) </h3>
<div class="flex-box row">
<div>1</div>
<span>2</span>
<div>3</div>
<span>4</span>
</div>
</section>
<section>
<h3> flex.row-reverse </h3>
<div class="flex-box row-reverse">
<div>1</div>
<span>2</span>
<div>3</div>
<span>4</span>
</div>
</section>
<section>
<h3> flex.column </h3>
<div class="flex-box column">
<div>1</div>
<span>2</span>
<div>3</div>
<span>4</span>
</div>
</section>
<section>
<h3> flex.column-reverse </h3>
<div class="flex-box column-reverse">
<div>1</div>
<span>2</span>
<div>3</div>
<span>4</span>
</div>
</section>
<section>
<h3> flex.nowrap(默认):不换行。</h3>
<div class="flex-box nowrap">
<div>1</div>
<span>2</span>
<div>3</div>
<span>4</span>
</div>
</section>
<section>
<h3> flex.wrap 换行,第一行在上方。</h3>
<div class="flex-box wrap w500">
<div>1</div>
<span>2</span>
<div>3</div>
<span>4</span>
</div>
</section>
<section>
<h3> flex.wrap 换行,第一行在下方。</h3>
<div class="flex-box wrap-reverse w500">
<div>1</div>
<span>2</span>
<div>3</div>
<span>4</span>
</div>
</section>
</body>
</html>