css3作业 导航条的响应式布局

"Hello World, Hello Blog"

Posted by wudimingwo on December 15, 2018

好烂,没写完 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
<!DOCTYPE html>
<html>

  <head>
    <meta charset="UTF-8">
    <meta name="viewprot" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>dddd</title>
    <link rel="stylesheet" type="text/css" href="css/test.css" />
    <style type="text/css">

    </style>
  </head>

  <body>
      <div class="wrapper">
        <div class="navlist">
          <ul class="nav">
            	<li><a href="#">Bootstrap</a></li>
            	<li><a href="#">起步</a></li>
            	<li><a href="#">全局CSS样式</a></li>
            	<li><a href="#">组件</a></li>
            	<li><a href="#">JavaScript插件</a></li>
            	<li><a href="#">定制</a></li>
            	<li><a href="#">网站实例</a></li>
            	<li><a href="#">BootStrap中文网</a></li>
          </ul>
        </div>
        <div class="content">
          <div class="logo">
            B
          </div>
          <div class="describe">
            Bootstrap 是最受欢迎的 HTML、CSS 和 JS 框架,用于开发响应式布局、移动设备优先的 WEB 项目。
          </div>
          <div class="download">
            <a href="#">下载 BootStrap</a>
          </div>
          <div class="versionDes">
            当前版本: v3.3.7 | 文档更新于:2018-11-07
          </div>
          <div class="hr"></div>
          <div class="shequ">
            <a href="#">访问前端社区</a>
          </div>
          <div class="juejin">
            <a href="#">来掘金,和更多前端开发者交流</a>
          </div>
        </div>
      </div>
      
  </body>

</html>

scss

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
:root,body{
    margin: 0;
    padding: 0;
}
.wrapper{
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    align-items: center;
    .navlist{
        width: 90%;
        height: 50px;
        display: flex;
        justify-content: center;
    .nav{
        box-sizing: border-box;
        width: 100%;
        height: 50px;
        background-color: #fff;
        
        display: flex;
        flex-direction: column;
        flex-wrap: wrap;
        
        line-height: 50px;
        padding: 0;
        margin: 0;
        align-content: flex-start;
        position: relative;
        li{
            list-style: none;
            height: 100%;
            padding: 0 20px;
            a{
                color: #563d7c;
                text-decoration: none;
                font-weight: 500;
                font-size: 16px;
            }
            &:hover{
                background-color: rgb(249,249,249);
            }
        }
        
        li:nth-last-of-type(1){
            position: absolute;
            right: 0;
        }
        
    }
        @media screen and (max-width:1000px) and (min-width:800px) {
            .nav{
                width: 700px;
            min-width: 700px;
            align-content: space-around;
            li{
                padding: 0 10px;
                a{
                    font-size: 14px;
                }
            }
            li:nth-last-of-type(1){
                position: static;
            }
        }
        }
        @media screen and(max-width:800px) {
            
            .nav{
                width: 100%;
                flex-direction: column;
                flex-wrap: nowrap;
                li{
                    background-color: #fff;
                }
                li:not(:nth-of-type(1)){
                    height: 0;
                    transition: height .5s;
                    a{
                        font-size: 0;
                    }
                }
                li:nth-of-type(1)::after{
                    content: "aaa";
                    display: inline-block;
                    margin-right: 10px;
                    float: right;
                }
                li:nth-last-of-type(1){
                    position: static;
                }
                &:active{
                    li{
                        display: inline-block;
                        height: 100%;
                        a{
                            font-size: 16px;
                        }
                    }
                }
            }
            
        }
    }
            @media screen and(max-width:800px) {
            .navlist{
                width: 100%;
            }
            }
    .content{
        width: 100%;
        height: calc(100vh - 50px);
        background-color: #6f5499;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        .logo{
            width: 144px;
            height: 144px;
            border: 2px solid #fff;
            border-radius: 20px;
            font-size: 108px;
            font-weight: bold;
            text-align: center;
            line-height: 144px;
            color: white;
            font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
            
            margin-bottom: 50px;
        }
        .describe{
            font-size: 30px;
            font-weight: 300;
            color: white;
            width: 1000px;
            min-width: 753px;
            text-align: center;
            margin-bottom: 50px;
        }
        @media screen and (max-width:1000px) and (min-width:800px) {
            .describe{
                width: 600px;
                font-size: 25px;
            }
        }
        @media screen and (max-width:800px) {
            .describe{
                width: 70%;
                font-size: 20px;
            }
        }
        
        .download{
            border: 1px solid white;
            border-radius: 15px;
            padding: 15px 35px;
            margin-bottom: 15px;
            a{
                font-size: 20px;
                color: white;
                text-decoration: none;
            }
        }
        .versionDes{
            color: #9783b9;
            font-size: 14px;
            margin-bottom: 30px;
        }
        .hr{
            width: 90%;
            border-bottom: 1px solid #444444;
            margin-bottom: 30px;
        }
        .shequ{
            padding: 15px 35px;
            border: 1px solid white;
            border-radius: 15px;
            a{
                text-decoration: none;
                font-size: 20px;
                color: white;
            }
        }
        .juejin{
            a{
                text-decoration: none;
                font-size: 15px;
                color: #bdb0d4;
                &:hover{
                    color: #dcd2ef;
                }
            }
        }
    }
}