flex弹性:圣杯布局
页面布局中比较常见的一个模式,圣杯布局。
代码实例如下:
|
01
02
03
04
05
06
07
08
09
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
|
<!doctype html><html><head><meta charset="utf-8"><title>蚂蚁部落</title><style>* { margin: 0px; padding: 0px;}.box { display: flex; flex-direction: column; width: 100%; min-height: 100vh; background-color: yellow; text-align: center; font-size: 30px;}header, footer { flex: 0 0 80px; line-height: 80px;}header { background-color: pink;}footer { background-color: gray;}.content { display: flex; flex: 1;}nav { order: -1; background-color: blue; flex: 0 0 80px;}aside { background-color: green; flex: 0 0 80px;}main { flex: 1;}</style></head><body> <div class="box"> <header>header</header> <div class="content"> <main>main</main> <nav>nav</nav> <aside>aside</aside> </div> <footer>footer</footer> </div></body></html> |
THE END







