123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>Document</title>
- <style>
- * {
- margin: 0;
- padding: 0;
- list-style: none;
- text-decoration: none;
- box-sizing: border-box;
- }
- .box {
- /* width: 1500px; */
- }
- .header {
- width: 100%;
- height: 75px;
- /* background: #00f; */
- }
- .header .nav {
- width: 1200px;
- height: 100%;
- /* background: #ff0; */
- /* 已知宽高的盒子水平居中
- auto 自适应
- */
- margin: 0 auto;
- }
- .header .nav ul {
- overflow: hidden;
- }
- .header .nav ul li {
- float: left;
- margin-left: 25px;
- margin-top: 22px;
- }
- .header .nav ul li a {
- color: #000;
- }
- .header .nav ul li:first-child {
- margin-left: 0;
- }
- .header .nav ul li:first-child a {
- color: #31ccff;
- }
- .header .nav ul li a:hover {
- color: #31ccff;
- }
- .main div {
- width: 200px;
- height: 200px;
- /* float: left; */
- }
- .main .one {
- background: #f00;
- }
- .main .two {
- background: #0ff;
- float: left;
- }
- .main .three {
- width: 400px;
- height: 400px;
- float: left;
- background: #f0f;
- }
- .main .four {
- height: 300px;
- background: #0f0;
- }
- </style>
- </head>
- <body>
- <!--
- 为什么要语义化?
- 1.高效、便携开发
- 2.搜索引擎寻找信息
- 想让标签在一行展示?
- 浮动:让元素在一行展示
- float:left/right/none
- 特点:脱离文档流 不占位
- -->
- <div class="box">
- <!-- 头部样式 -->
- <div class="header">
- <div class="nav">
- <ul>
- <li><a href="">内容1</a></li>
- <li><a href="">内容2</a></li>
- <li><a href="">内容3</a></li>
- <li><a href="">内容4</a></li>
- <li><a href="">内容5</a></li>
- </ul>
- </div>
- </div>
- <!-- 主体样式 -->
- <div class="main">
- <div class="one"></div>
- <div class="two"></div>
- <div class="three"></div>
- <div class="four"></div>
- </div>
- <!-- 尾部样式 -->
- <div class="footer"></div>
- </div>
- </body>
- </html>
|