<main>
  <div class="wrapper">
    <article class="flow">
      <h1>Extra space in the grid container</h1>
      <figure class="callout">
        <p>The <code>align-content</code> property distributes space in the block direction. The <code>justify-content</code> property in the inline direction.</p>
      </figure>
      <div class="controls">
        <label>
          Choose aligment
          <select id="switcher">
            <option value="stretch">stretch</option>
            <option value="start">start</option>
            <option value="end">end</option>
            <option value="center">center</option>
            <option value="space-between">space-between</option>
            <option value="space-around">space-around</option>
            <option value="space-evenly">space-evenly</option>
          </select>
        </label>
        <label>
          Choose justification
          <select id="switcher2">
            <option value="stretch">stretch</option>
            <option value="start">start</option>
            <option value="end">end</option>
            <option value="center">center</option>
            <option value="space-between">space-between</option>
            <option value="space-around">space-around</option>
            <option value="space-evenly">space-evenly</option>
          </select>
        </label>
      </div>
      <div class="container" id="container">
        <div class="box">Item one</div>
        <div class="box">Item two</div>
        <div class="box">Item three</div>
        <div class="box">Item four</div>
        <div class="box">Item five</div>
      </div>
    </article>
  </div>
</main>
/* Copyright 2018 Google LLC.
SPDX-License-Identifier: Apache-2.0 */

/* CSS files add styling rules to your content */
:root {
  --var-justify-content: 'start';
  --var-align-content: 'start';
}

body {
  font-family: system-ui,-apple-system,sans-serif;
  margin: 2em;
}

.container {
  display: grid;
  align-content: var(--var-align-content);
  justify-content: var(--var-justify-content);
  grid-template-columns: auto auto auto;
  grid-template-rows: 90px 100px;
  gap: 10px;
  background-color: #dadce0;
  padding: .5em;
  border-radius: 3px;
  max-inline-size: 600px;
  block-size: 520px;
}



.box:nth-child(1) {
  grid-row: 1 / 3;
  grid-column: 1;
}

.box:nth-child(3) {
  grid-row: 2;
  grid-column: 2 / -1;
}

.controls label {
      display: inline-grid;
    grid-template-columns: minmax(150px, max-content) 1fr;
    gap: 0 1rem;
    align-items: center;
}
let root = document.documentElement;
let switcher1= document.getElementById("switcher");
switcher1.addEventListener("change", function (evt) {
  root.style.setProperty('--var-align-content', evt.target.value);
});

let switcher2= document.getElementById("switcher2");
switcher2.addEventListener("change", function (evt) {
  root.style.setProperty('--var-justify-content', evt.target.value);
});

External CSS

  1. https://codepen.io/web-dot-dev/pen/abpoXGZ.css

External JavaScript

This Pen doesn't use any external JavaScript resources.