<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
/* CSS书写顺序 浏览器执行效率更高
1.浮动/display
2.盒子模型 margin border padding 宽高背景色
3.文字样式
*/
/* div {
margin: 90px auto;
background-color: pink;
width: 400px;
height: 400px;
box-sizing: border-box;
} */
ul {
/* padding: 50px 80px;
width: 100px;
height: 100px; */
/* margin: 0 auto; */
}
/* li {
list-style: none;
padding: 10px;
color: rgb(255, 0, 149);
} */
/* 选中奇数 */
/* li:nth-child(2n-1) {
background-color: darkorchid;
} */
/* 选中第一个li的第二个a */
li:first-child a:nth-child(2) {
color: red;
}
/* 伪元素默认行内元素*/
/* .father::before {
content: '帅';
display: block;
width: 100px;
height: 100px;
background-color: blue;
}
.father::after {
content: '逼人';
}
/* 浮动 可以使块标签排列在一行且中间没有空格*/
/* .one {
width: 100px;
height: 100px;
background-color: aqua;
float: left;
} */
/* 浮动 maigin 无法生效*/
/* .two {
width: 200px;
height: 200px;
background-color: blue;
float: left;
} */
/* .three {
width: 300px;
height: 300px;
background-color: pink;
float: left;
} */
* {
margin: 0;
padding: 0;
}
.top {
height: 40px;
background-color: #333;
}
.head {
width: 1226px;
height: 100px;
background-color: #ffc0cb;
margin: 0 auto;
}
/* 大盒子 放里面两个小盒子标签 */
.fathe {
margin: 0 auto;
width: 1226px;
height: 460px;
background-color: blue;
}
/* 设置宽度以免下面的盒子放不下 */
.bood {
float: left;
width: 234px;
height: 460px;
background-color: #ffa500;
}
.base {
width: 992px;
height: 460px;
background-color: #87ceeb;
float: left;
}
</style>
</head>
<body>
<!-- <div>
<ul>
<li>
<a href="#">111</a>
<a href="#">111</a>
<a href="#">111</a>
</li>
<li>这是第2个li</li>
<li>这是第3个li</li>
<li>这是第4个li</li>
<li>这是第5个li</li>
<li>这是第6个li</li>
<li>这是第7个li</li>
<li>这是第8个li</li>
<div class="father">气</div>
</ul>
<div class="one"></div>
<div class="two"></div>
<div class="three"></div>
</div> -->
<div class="top"></div>
<div class="head"></div>
<div class="fathe">
<div class="bood"></div>
<div class="base"></div>
</div>
</body>
</html>
CSS第四天-浮动
最新推荐文章于 2024-07-20 21:01:09 发布