I have content that I want to display over three columns. Each content is nested inside a box (div). Each box, has its own dynamic height (based on the content). My first approach was:
#boxes {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
.box {
  background-color: #000;
}<div id="boxes">
  <div class="box" style="height: 900px"></div>
  <div class="box" style="height: 200px"></div>
  <div class="box" style="height: 500px"></div>
  <div class="box" style="height: 400px"></div>
  <div class="box" style="height: 900px"></div>
  <div class="box" style="height: 100px"></div>
  <div class="box" style="height: 500px"></div>
  <div class="box" style="height: 200px"></div>
  <div class="box" style="height: 700px"></div>
  <div class="box" style="height: 300px"></div>
</div>As you can see, it did split them into three columns, but there are lots of dead spaces between them. I'm trying to build a dynamic layout that will shrink between the boxes. Something like this:

