# Holy Grail Layout

> Header, footer, two sidebars and content with named grid areas. Stacks on small screens.

- Category: [CSS Layouts](https://copy-css.com/category/layouts)
- Tags: grid, grid-template-areas, header, sidebar, page
- Live preview: https://copy-css.com/snippets/holy-grail-layout
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<div class="holy-grail">
  <header>Header</header>
  <nav>Nav</nav>
  <main>Content</main>
  <aside>Aside</aside>
  <footer>Footer</footer>
</div>
```

## CSS

```css
.holy-grail {
  display: grid;
  grid-template:
    "header header header" auto
    "nav    main   aside" 1fr
    "footer footer footer" auto
    / 200px 1fr 200px;
  gap: 16px;
  min-height: 100vh;
}

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

@media (max-width: 720px) {
  .holy-grail {
    grid-template:
      "header" auto
      "nav" auto
      "main" 1fr
      "aside" auto
      "footer" auto
      / 1fr;
  }
}
```

## Notes

- This CSS Holy Grail Layout is 28 lines of pure CSS (0.6 KB) with no JavaScript and no dependencies. It uses CSS Grid.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
