<div class="container">
  <div class="header"></div>
  <div class="aside"></div>
  <div class="main"></div>
  <div class="footer"></div>
.container {
  display: grid;
  grid-template-columns: 300px 1fr;
  grid-template-rows: auto 1fr auto;
  grid-auto-rows: 1fr;
  gap: 20px;
  grid-auto-flow: row;
    "header header"
    "aside main"
    "footer footer";
@media (max-width: 600px){
  grid-template-columns: 1fr;
  grid-template-rows: auto auto 1fr auto;

.header { grid-area: header; }
.footer { grid-area: footer; }
.aside { grid-area: aside; }
.main { grid-area: main; }

html, body , .container {
  height: 100%;
  margin: 0;
/* For presentation only, no need to copy the code below */

.container * {
  min-height: 2em;
  background-color: #A0DBF2;
  position: relative;

.container *:after {
  content: attr(class);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: grid;
  align-items: center;
  justify-content: center;

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.