<div class="grid__container">
  <div class="grid__item">A</div>
  <div class="grid__item">B</div>
  <div class="grid__item grid__container--subgrid">
    <div class="grid__subitem grid__item">C1</div>
    <div class="grid__subitem grid__item">C2</div>
  </div>
</div>

<div class="form">
  <label for="column-gap">column-gap:</label>
  <select name="column-gap" id="column-gap">
    <option value="50px">50px</option>
    <option value="0px">0px</option>
    <option value="20px">20px</option>
    <option value="80px">80px</option>
  </select>
</div>

<div class="warning">
  <p>Subgrid support required to get the most out of this pen</p>
</div>
@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;
  font-family: "Exo", Arial, sans-serif;
  background-color: #557;
  padding: 4rem 0;
}

.warning {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.5rem;
  background-color: #fed7d7;
  border-top: 1px solid #f56565;
  padding: 10px;
  color: #f56565;
}

@supports (grid-template-rows: subgrid) {
  .warning {
    display: none;
  }
}

.form {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 2rem;
  gap: 10px;
  color: #fff;
}

.grid__container {
  height: calc(80vh - 8rem);
  max-width: 1024px;
  margin: 0 auto;
  outline: 3px solid #111;
  background: #333;
}
.grid__item {
  background: #557;
  position: relative;
}
.grid__item:not(.grid__container--subgrid) {
  display: flex;
  justify-content: center;
  align-items: center;
  color: #fff;
  font-size: 1.5rem;
  text-shadow: 1px 1px 0 rgb(0 0 0 / 0.8);
}

.grid__container--subgrid {
  width: 100%;
}

.grid__subitem {
  background: #ccc;
  position: relative;
  color: #000 !important;
  text-shadow: 1px 1px 0 rgb(255 255 255 / 0.8) !important;
}

.grid__container {
  width: 300px;
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 50px;
}

.grid__container--subgrid {
  grid-column: 1 / span 2;
  display: inherit;
  grid-template-columns: subgrid;
  column-gap: var(--column-gap, normal);
}
const rootElement = document.documentElement;

const select = document.getElementById("column-gap");

select.addEventListener("click", (etv) => {
  rootElement.style.setProperty("--column-gap", etv.target.value);
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.