25 CSS Hacks Every Developer Should Know

CSS grid with named areas

Problem: creating complex layouts with named grid areas.

Solution: use `grid-template-areas`.

.grid-container {
  display: grid;
  grid-template-areas:
  'header header'
  'sidebar content'
  'footer footer';
  grid-gap: 10px;
}
.header {
  grid-area: header;
}
.sidebar {
  grid-area: sidebar;
}
.content {
  grid-area: content;
}
.footer {
  grid-area: footer;
}