liveBook · Manning

Grid area

As explained in Web Design Playground, Second Edition

A named grid area is a rectangular region of CSS Grid cells identified by a shared name.

A grid area is a portion of a CSS Grid that spans one or more cells. A named grid area gives that rectangle a shared name, such as header, nav, main, sidebar, or footer. section 13.7 section 13.8

Define the names on the grid container with grid-template-areas, writing one space-separated name for every cell in each row. Repeat a name to make an area wider or taller; use periods for empty cells. Then assign each grid item with grid-area. section 13.8

A classic page layout

A five-column grid can describe a familiar layout in plain sight: 'header header header header header', 'nav nav nav nav nav', 'main main main main sidebar', and 'footer footer footer footer footer'. Assign the corresponding items with grid-area: header, nav, main, sidebar, and footer. The browser then places and spans those items according to the named map—rather less mysterious than wrestling a layout library. section 13.8

How Web Design Playground, Second Edition covers it

How deep it goes
Defines area naming, spanning, empty cells, and assignment, then demonstrates a complete layout without covering browser internals.
Examples
Uses header, nav, main, sidebar, and footer to build a classic holy grail page layout.
What it assumes
Introduces grid cells, grid lines, rows, and columns before using named areas.
What you can do after
Build a named CSS Grid layout by mapping cells to areas and assigning items with grid-area.
How it connects
Connects CSS Grid Layout with grid cells, grid lines, grid-template-areas, and the grid-area property.

Also explained in

Compare how 2 books explain grid area →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Web Design Playground, Second Edition. The section links point to the parts of the book it draws on.