<div class="grid">
<div>One</div>
<div>Two</div>
<div>Three</div>
<div>Four</div>
</div>
* { box-sizing: border-box; }
body {
margin: 40px;
background-color: #fff;
color: #444;
font: 1.4em Arial, sans-serif;
}
.grid {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
grid-auto-rows: 100px;
grid-gap: 20px;
}
.grid > * {
padding: 10px;
border: 5px solid rgba(214,129,137,.5);
border-radius: 5px;
background-color: rgba(233,78,119,.5);
color: #fff;
float: left;
width: 23%;
margin: 0 1%;
}
@supports (display:grid) {
.grid > * {
width: auto;
margin: 0;
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.