把网页先分成上下一共四个,再把其中一个分成左右。
<!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>
div {
box-sizing: border-box;
text-align: center;
line-height: 250px;
font-size: 60px;
color: cornflowerblue;
}
.container{
width: 100%;
height: 1000px;
}
.container .box {
height: 250px;
border: 1px solid #000;
padding: 16px 8px;
margin-bottom: 2px;
background-color: rgb(150, 218, 186);
}
.container .box.flex {
display: flex;
align-items: center;
justify-content: space-between;
}
.container .box .left,
.container .box .right {
flex-grow: 1;
display: inline-block;
border: 1px solid rgb(202, 38, 38);
height: 100%;
}
</style>
</head>
<body>
<div class="container">
<div class="box">1</div>
<div class="box flex">
<div class="left">2-1</div>
<div class="right">2-1</div>
</div>
<div class="box">3</div>
<div class="box">4</div>
</div>
</body>
</html>
div+flex布局 ,或者 float ,再或者table布局