← All Exercises
Lay Out a Page with Named Grid Areas
intermediatecss
Background
Named grid areas make layout intent readable and let media queries reorder regions without touching the markup.
Problem
Create a page shell with header, sidebar, main, and footer regions using named grid areas that become a single readable column with main before sidebar on narrow screens.
Input
Four page regions with sidebar navigation and article content.
Output
CSS grid rules for wide and narrow viewports.
Sample tests
Sample 1
Input: Viewport width 1280px
Expected: grid-template-areas places header and footer across two columns with sidebar beside main
Sample 2
Input: Viewport width 480px
Expected: a max-width 48rem media query switches to one column with main before sidebar
Your solution
Learning objective
Place page regions with named grid areas and restructure them at a breakpoint without changing markup.