CSS Grid布局-项目跨行
html公开前 25 行,完整代码需登录
<style>
.grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(3, 100px);
gap: 10px;
background-color: #e8e8e8;
padding: 10px;
}
.grid-item {
background-color: #2196F3;
border: 1px solid #000;
color: white;
font-size: 24px;
font-weight: bold;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
}
.grid-item:nth-child(1) {
grid-row: 1 / 3;
background-color: #4CAF50;
}
.grid-item:nth-child(4) {