Skip to content
IndexRequest a UIAboutContact

Holy Grail Three-column Layout

Header, nav, main, aside and footer in CSS grid areas that collapse to one column when the width shrinks.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI IMAGE OR VIDEO TOOL
Clean wireframe diagram of a web page layout with five labelled regions in a light neutral palette: a header bar across the top, a left navigation column, a wide main content area, a right aside column and a footer bar across the bottom, drawn with thin outlines and soft grey fills; beside it a narrow phone-width version with the regions stacked in the order header, main, navigation, aside, footer. Negative: gradients, shadows, clutter, text errors. Reduced motion: static diagram.

About this pattern

Definition

The holy grail layout has a header, a footer and three columns between them: navigation, main content and an aside. With CSS grid areas it needs no hacks, the main content can come first in the HTML for accessibility, and the layout can collapse to a single column when space runs out.

When to use it

  • grid-template-areas names the regions; the middle column uses minmax so main grows and the sides stay fixed.
  • Put main first in the source so keyboard and screen reader users reach it early.
  • At narrow widths switch to one column: header, main, nav, aside, footer.
  • Container queries let the layout respond to its own width, not the window.

What the controls do

  • A width slider resizes the frame; the layout switches at about 320px.

Motion & timing

  • The layout changes instantly as the width changes.
  • Reduced motion: no animation is involved.

Tips & variations

  • Use landmarks: header, nav, main, aside, footer.
  • Do not let the aside push essential content below a very long list.

Code of this live preview

HTML
<div class="bx"><div class="fw" id="fw"><div class="pg"><header>Header</header><main>Main content</main><nav>Nav</nav><aside>Aside</aside><footer>Footer</footer></div></div><label class="rw">Width <b id="wv">380px</b><input id="ws" type="range" min="200" max="380" value="380"></label><p class="out" id="out"></p></div>

Related patterns

Sticky Footer Layout

↗
Sticky Footer LayoutLayout & Scrolling

Sidebar

↗
SidebarNavigation

Container Query Cards

↗
Container Query CardsLayout & Scrolling