<div class="container">
    <div class="item">One</div>
    <div class="item">Two</div>
    <div class="item">Three has much more content than all of the others.</div>
    <div class="item">Four</div>
    <div class="item">Five</div>    
.container {
  display: grid;
  grid-template-columns: repeat(auto-fit, 100px);
  grid-gap: 20px;

.item {
    padding: 10px;
    border: 5px solid rgb(17, 105, 121);
    background-color: rgba(17, 105, 121,.1);
    border-radius: 5px;

* { box-sizing: border-box; }

body {
    font: 1.1em/1.3 Tahoma, Verdana, Segoe, sans-serif;
    background-color: #fff;
    color: #333;
    max-width: 960px;
    margin: 1em auto;
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.