一. 声明DIV
<body>
<!--
作者:1710076498@qq.com
时间:2018-10-08
描述:div+css实现模板
-->
<div class="x1">
<a href="h1.html">
<img src="img/5b70c23034da1.jpg" />
</a>
</div>
<div class="x2">
</div>
<div class="x3">
</div>
<div class="x4">
</div>
</body>
二,布局写好
.x1{
width: 100%;
height: 150px;
background: #90bbcc;
}
.x1 img{
height: 100%;
}
.x2{
width: 100%;
height: 80px;
background: #cc5500;
}
.x3{
float: left;
width: 50%;
height: 800px;
background: #9c55bb;
}
.x4{
float: left;
width: 50%;
height: 800px;
background: #ffdd00;
}
</style>
布局写好之后,发现还有留白可以使用margin,如下
body{
margin: 0px;
}