<div class="grid">
<div class="box item1">Item 1</div>
<div class="box item2">Item 2</div>
<div class="box item3">Item 3</div>
<div class="box item4">Item 4</div>
</div>
.grid {
display: grid;
grid-gap:20px;
/* grid-template-columns: 1fr 1fr 1fr 1fr; */
/* grid-template-rows: 100px auto 100px; */
/* Short record (rows / column) */
grid-template: 100px auto 100px / 1fr 1fr 1fr 1fr;
}
.box {
background-color: #444;
color: #fff;
border-radius: 5px;
padding: 20px;
font-size: 150%;
}
.item1 {
background: #f00;
}
.item2 {
background: #f0f;
}
.item3 {
background: #008000;
}
.item4 {
background: #000;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.