老师这节课的第二个实操,其实也有第二种方法,全部浮动向左好理解些。
<!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;
}
.container {
height: 600px;
width: 600px;
}
.left {
float: left;
height: 600px;
width: 200px;
background-color: rgb(205, 196, 255);
}
.right {
float: left;
height: 600px;
width: 400px;
background-color: bisque;
}
.top {
height: 300px;
width: 400px;
background-color: rgb(28, 162, 196);
}
.bottom-left {
float: left;
height: 300px;
width: 200px;
background-color: rgb(196, 28, 196);
}
.bottom-right {
float: left;
height: 300px;
width: 200px;
background-color: rgb(109, 196, 28);
}
</style>
</head>
<body>
<div class="container">
<div class="left"></div>
<div class="right">
<div class="top"></div>
<div class="bottom-left"></div>
<div class="bottom-right"></div>
</div>
</div>
</body>
</html>