不再需要盒子嵌套了🎉
<!DOCTYPE html>
<html lang="zn">
<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;
box-sizing: border-box;
}
.parent {
height: 600px;
background: #444;
padding-bottom: 20px;
}
.parent>div {
background: #fffae5;
box-shadow: inset 3px 3px 6px 4px #e0d6af;
border-radius: 5px;
margin: 5px;
font-size: 3vw;
color: #fffae5;
font-weight: bold;
display: flex;
justify-content: center;
align-items: center;
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
text-shadow: 2px 2px 5px #777;
}
.parent {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-template-rows: repeat(6, 1fr);
grid-gap: 5px;
}
.div1 {
grid-area: 1 / 1/ 3 / 3;
}
.div2 {
grid-area: 3 / 2 / 5 / 4;
}
.div3 {
grid-area: 5 / 2 / 6 / 3;
}
.div4 {
grid-area: 5 / 3 / 7 / 4;
}
.div5 {
grid-area: 4 / 4 / 5 / 5;
}
.div6 {
grid-area: 3 / 4 / 4 / 5;
}
</style>
</head>
<body>
<div class="parent">
<div class="div1">1</div>
<div class="div2">2</div>
<div class="div3">3</div>
<div class="div4">4</div>
<div class="div5">5</div>
<div class="div6">6</div>
</div>
</body>
</html>