<div class="wrapper">
<div class="box box1">1</div>
<div class="box box2">2</div>
<div class="box">3</div>
<div class="box">4</div>
<div class="box">5</div>
</div>
body {
margin: 40px;
}
.box {
background-color: #444;
color: #fff;
border-radius: 5px;
padding: 20px;
font-size: 150%;
}
.box:nth-child(even) {
background-color: #ccc;
color: #000;
}
.wrapper {
display: grid;
border:1px solid #000;
grid-gap: 10px;
grid-template-columns: repeat(auto-fit, minmax(100px,1fr) minmax(200px,2fr));
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.