<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
body {
  display: grid;
  height: 100vh;
  grid-gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

// etc

div {
  display: grid;
  place-items: center;
  background: lightpink;
}

body {
  font-family: system-ui, sans-serif;
}
View Compiled
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.