liveBook · Manning

Layout

As explained in CSS in Depth, Second Edition

A page layout is the overall spatial arrangement of a web page's major sections and content regions.

A page layout is the spatial arrangement of major sections and content regions. Build it from the outside in: establish headers, footers, sidebars, columns, and grids before fine-tuning internal components. section 3.0 section 8.2.4

The browser calculates each element’s size and position during the layout stage. Because document flow connects elements, changing dimensions, position properties, or the DOM can trigger layout recalculation and reflow. section 16.3.1

Practical layout decisions include:

  • Use a layout layer for page-wide structure, such as headers, footers, sidebars, columns, and large grids. section 8.2.4
  • Define separate structures for genuinely different pages, such as home, article, and search-results layouts. section 8.2.4
  • Choose IDs for unique page layouts and classes for layouts that may repeat; an l- prefix can distinguish layout classes from module classes. section 8.2.4

A two-column page structure

A homepage can use CSS Grid with header and footer spanning both columns, while an article can constrain its main content and center it with auto margins.

Figure 16.12 The three stages of the rendering pipeline
figure

Trace layout as the first stage of rendering, followed by paint and composite. section 16.3.1

How CSS in Depth, Second Edition covers it

How deep it goes
Descends from document flow and box-model foundations to page structures, selector choices, grid examples, and rendering reflow.
Examples
Uses one-column pages, homepage and article structures, two-column grids, spanning headers and footers, and centered constrained content.
What it assumes
Assumes basic CSS while teaching document flow, box-model sizing, element placement, and practical page-structure decisions.
What you can do after
Build it from scratch by structuring page regions, selecting reusable layout selectors, and anticipating layout-triggered reflow.
How it connects
Connects document flow, the box model, CSS Grid, cascade layers, reflow, paint, and composite.

Also explained in

Compare how 7 books explain layout →

Related concepts

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