<!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>
*{
margin: 0px;
padding:0px;
list-style: none;
}
/* 并集选择器,样式一样的时候,可以合并。使用逗号 */
.header,.con,.wrap{
width: 1000px;
margin:10px auto;
}
.header{
height: 80px;
margin-top: 0px;
}
.header,.con,.nav,.footer{
background: skyblue;
}
.nav{
height: 50px;
}
.con{
height: 330px;
}
.wrap{
height: 500px;
}
.footer{
height: 300px;
}
.wrap div{
background: skyblue;
float: left;
/* 父级宽度不够,子级自动落下 */
}
.one{
width:280px;
height: 500px;
margin-right: 10px;
}
.two{
width:710px;
height: 100px;
margin-bottom: 10px;
}
.three{
width:200px;
height: 280px;
margin-right: 10px;
}
.four{
width: 500px;
height: 280px;
}
.five{
width:710px;
height: 100px;
margin-top: 10px;
}
</style>
</head>
<body>
<!-- emmet插件 -->
<div class="header"></div>
<div class="nav"></div>
<div class="con"></div>
<div class="wrap">
<div class="one"></div>
<div class="two"></div>
<div class="three"></div>
<div class="four"></div>
<div class="five"></div>
</div>
<div class="footer"></div>
</body>
</html>
在样式中选择器是有权重的:
*(全局选择器1g)<标签选择器(1kg)<类名选择器(10kg)
组合之后大于原来权重!!!
还有:后代选择器,伪类选择器(:nth-of-type,:hover),分组选择器(不同标签或类用逗号隔开)
css有三种书写方式:外链 , 内联 , 行内样式(通常不建议这样写,除非是急用