hooyantsing's Blog

P126_26_使用margin自动撑满空间技巧

字数统计: 191阅读时长: 1 min
2020/04/20

P126 26 使用margin自动撑满空间技巧

**

**

margin-right:auto;

d381959ef7c22cf8d74be562233e3af2.png

77ae6d8d01dd5675f055af2d051ef981.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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        nav{
            width: 1400px;
            height: 50px;
            background: #f3f3f3;
            margin: 0 auto;
            display: flex;
            flex-direction: row;
        }
        nav ul{
            list-style-type: none;
            display: flex;
            flex-direction: row;
            align-items: center;
        }
        nav ul:first-child{
            margin-right: auto;
        }
        nav ul:first-child li{
            margin: 0 10px;
        }
        nav ul:last-child li{
            width: 50px;
            height: 50px;
            background: #9b59b6;
            border-radius: 50%;
        }
    </style>
</head>
<body>
<nav>
    <ul>
        <li>首页</li>
        <li>视频教程</li>
        <li>晚八点直播</li>
    </ul>
    <ul>
        <li></li>
    </ul>
</nav>
</body>
</html>
CATALOG