用《CSS浮动》文章里的内容完成布局案例一
效果图
代码实现
<!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: 0;
padding: 0;
}
.top {
height: 40px;
background-color: #333;
}
.header {
width: 1226px;
height: 100px;
background-color: #ffc0cb;
margin: 0 auto;
}
.con {
width: 1226px;
height: 460px;
background-color: rgb(214, 86, 171);
margin: 0 auto;
}
.left{
float: left;
width: 234px;
height: 460px;
background-color: #ffa500;
}
.right{
float: left;
width: 992px;
height: 460px;
background-color: #87ceeb;
}
</style>
</head>
<body>
<div class="top"></div>
<div class="header">header</div>
<div class="con">
<div class="left">left</div>
<div class="right">right</div>
</div>
</body>
</html>