<section>
  <div class="grid__container">
    <div class="grid__item"></div>
    <div class="grid__item"></div>
    <div class="grid__item"></div>
    <div class="grid__item"></div>
    <div class="grid__item"></div>
    <div class="grid__item"></div>
    <div class="grid__item"></div>
    <div class="grid__item"></div>
    <div class="grid__item"></div>
    <div class="grid__item"></div>
    <div class="grid__item"></div>
  </div>
</section>

<form action="">
  <label for="row-gap">
    row-gap:
    <input type="range" name="row-gap" id="row-gap" min="0" max="50" value="10" />
    <span id="row-gap-output">10</span>px
  </label>
  <label for="column-grid">
    column-gap:
    <input type="range" name="column-gap" id="column-gap" min="0" max="50" value="10" />
    <span id="column-gap-output">10</span>px
  </label>
</form>
@import url("https://fonts.googleapis.com/css2?family=Exo:wght@600&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  width: 100vw;
  min-height: 100vh;

  display: flex;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  font-family: "Exo", Arial, sans-serif;
  background-color: #f7f7f7;

  padding: 20px;
}

section {
  max-width: 60vw;
  width: 100%;
  margin: 0 auto;
}

.grid__container {
  border: 1px dashed #f36;
  box-shadow: 0 0 0 6px rgb(0 0 0 / 13%);
  border-radius: 1px;
}

.grid__item {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  background-color: #f7f7f7;
  counter-increment: item;
}

.grid__item::before {
  content: counter(item);
  color: #fff;
  font-size: 3rem;
  text-shadow: 1px 1px 0 rgba(0 0 0 / 0.25);
}

.grid__item:nth-child(1) {
  background-color: #f1c2c6;
}

.grid__item:nth-child(2) {
  background-color: #dac2f1;
}

.grid__item:nth-child(3) {
  background-color: #ccf1c2;
}

.grid__item:nth-child(4) {
  background-color: #c2e9f1;
}

.grid__item:nth-child(5) {
  background-color: #f1ebc2;
}
.grid__item:nth-child(6) {
  background-color: #3f51b5;
}

.grid__item:nth-child(7) {
  background-color: #810d16;
}

.grid__item:nth-child(8) {
  background-color: #4d0d81;
}

.grid__item:nth-child(9) {
  background-color: #0d4e81;
}

.grid__item:nth-child(10) {
  background-color: #0d815f;
}
.grid__item:nth-child(11) {
  background-color: #2196f3;
}
.grid__item:nth-child(12) {
  background-color: #ff5722;
}

form {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 20px;
  gap: 10px;
}

form label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.grid__container {
  --row-gap: 10px;
  --column-gap: 10px;
  display: grid;
  grid-template-columns: repeat(3, 100px);
  grid-template-rows: repeat(2, 100px);
  grid-auto-rows: 60px;
  gap: var(--row-gap) var(--column-gap);
}

.grid__container .grid__item:nth-child(3) {
  grid-area: 1 / 4 / 4 / 5;
}

.grid__container .grid__item:nth-child(4) {
  grid-area: 1 / -5 / 4 / 1;
}
let inputs = document.querySelectorAll('input[type="range"]');
let gridContainer = document.querySelector(".grid__container");

inputs.forEach((input, index) => {
  input.addEventListener("input", (etv) => {
    gridContainer.style.setProperty(
      `--${etv.target.id}`,
      `${etv.target.value}px`
    );
    document.getElementById(`${etv.target.id}-output`).textContent =
      etv.target.value;
  });
});
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.