html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>练习·落以零</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="item1">1</div>
<div class="item2">2</div>
<div class="item3">3</div>
<div class="item4">4</div>
</div>
</body>
</html>
css
.container {
display: grid;
grid-template-columns: 50px 50px 50px;
grid-template-rows: 40px 40px 40px 40px;
}
.container > div{
border: 1px solid pink;
background: lightsalmon;
}
.item1{
grid-row: 1/2;
grid-column: 1/4;
}
.item2{
grid-row: 2/5;
grid-column: 1/2;
}
.item3{
grid-row: 2/5;
grid-column: 3/4;
}
.item4{
grid-row: 3/4;
grid-column: 2/3;
}
原文:https://www.cnblogs.com/luoyiling/p/9716103.html