Two-Column Layout with Long Sidebar Using CSS Grid

Variation on the classic site layout, done with Grid.

The Finished Example Layout

header

main

footer

The Code

HTML
<div class="container">
  <header class="header">
    <p>header</p>
  </header>

  <main class="content">
    <p>main</p>
  </main>

  <!-- Replace <div> with <aside> if your content has one aside. For more than one, nest <aside> elements in the <div>. -->
  <div class="sidebar">
    <p>sidebar</p>
  </div>

  <footer class="footer">
    <p>footer</p>
  </footer>
</div>
  
CSS
/* Grid
-------------------------------------- */
/* Define the grid */
.container {
  display: grid;
  grid-template-columns: 3fr 1fr;
  grid-gap: 10px 20px;
}

/* Place items on the grid */
.header {
  grid-column: 1 / -1;
}

.sidebar {
  grid-row-end: span 2;
}

/* Generic styles for demo purposes
-------------------------------------- */
.container {
  font-family: Helvetica, Arial, sans-serif;
  margin-left: auto;
  margin-right: auto;
  max-width: 75rem;
}

.container > * {
  background-color: #ccc;
  padding: 1em;
}

/* Typically, you wouldn't specify a height or min-height on this, instead allowing your actual content (i.e., text, images, etc.) to dictate the height of your content area. But since this example has very minimal content, I've set a min-height to mimic a taller content area. */
.content {
  min-height: 350px;
}