hooyantsing's Blog

P159_8_超酷的移动端视图切换

字数统计: 206阅读时长: 1 min
2020/04/21

P159 8 超酷的移动端视图切换

实战案例

介绍:

1、使用弹性盒子布局。

效果:

b578f148f5c494a36cf8345a6703738d.png

源码:

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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            height: 100vh;
            width: 100vw;
            display: flex;
            flex-direction: column;
        }

        main {
            flex: 1;
        }

        nav {
            height: 8vh;
            background: #34495e;
            display: flex;
            flex-direction: row;
            justify-content: space-evenly;
            align-items: center;
        }

        nav a {
            font-size: 2em;
            color: white;
            text-decoration: none;
            flex: 1;
            text-align: center;
            text-transform: uppercase;
            opacity: .8;
        }

        nav a:nth-child(2) {
            border-right: solid 1px silver;
            border-left: solid 1px silver;
        }
    </style>
</head>
<body>
<main></main>
<nav>
    <a href="">home</a>
    <a href="">video</a>
    <a href="">live</a>
</nav>
</body>
</html>
CATALOG