<section>
  <div class="grid__container">
    <div class="grid__item header"></div>
    <div class="grid__item aside"></div>
    <div class="grid__item main"></div>
    <div class="grid__item nav"></div>
    <div class="grid__item footer"></div>
  </div>
  <div class="grid__container">
    <div class="grid__item header"></div>
    <div class="grid__item aside"></div>
    <div class="grid__item main"></div>
    <div class="grid__item nav"></div>
    <div class="grid__item footer"></div>
  </div>
</section>

<form action="">
  <span>display:</span>
  <label for="grid">
    <input type="radio" name="display" id="grid" checked />
    grid
  </label>
  <label for="inline-grid">
    <input type="radio" name="display" id="inline-grid" />
    inline-grid
  </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 {
  width: 80vw;
  width: 100%;
  margin: 0 auto;

  display: flex;
  justify-content: center;
  gap: 60px;
}

.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: #444;
  font-size: 1.2rem;
  text-shadow: 1px 1px 0 rgba(0 0 0 / 0.025);
}

.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;
}

.header::before {
  content: "Header Area";
}
.aside::before {
  content: "Aside Area";
  white-space: nowrap;
}
.main::before {
  content: "Main Area";
}
.nav::before {
  content: "Nav Area";
  white-space: nowrap;
}
.footer::before {
  content: "Footer Area";
}

:root {
  --display: grid;
}

.grid__container {
  display: var(--display);
}

.grid__container:nth-child(1) {
  grid-template-areas:
    "header header header header"
    "aside main main nav"
    "footer footer footer footer";
}

.grid__container:nth-child(1) .header {
  grid-area: header;
}
.grid__container:nth-child(1) .aside {
  grid-area: aside;
}
.grid__container:nth-child(1) .main {
  grid-area: main;
  min-width: 20vw;
  min-height: 30vmin;
}
.grid__container:nth-child(1) .nav {
  grid-area: nav;
}
.grid__container:nth-child(1) .footer {
  grid-area: footer;
}

.grid__container:nth-child(2) {
  grid-template-columns: 150px 1fr 150px;
}

.grid__container:nth-child(2) .header {
  grid-area: 1 / 1 / 2 / 4;
}
.grid__container:nth-child(2) .main {
  min-width: 20vw;
  min-height: 30vmin;
}
.grid__container:nth-child(2) .footer {
  grid-area: 3 / 1 / 4 / 4;
}
let inputs = document.querySelectorAll('input[type="radio"]');
let rootElement = document.documentElement;

inputs.forEach((input, index) => {
  input.addEventListener("click", (etv) => {
    rootElement.style.setProperty("--display", etv.target.id);
  });
});
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.