liveBook · Manning

Grid

As explained in Math for Web Design

A regular system of intersecting rows and columns used to organize visual elements in a layout.

A grid organizes a layout into intersecting rows and columns, giving visual elements a clear structure for alignment, spacing, and proportion. Its dimensions are mathematical: fixed tracks and gaps consume space before fractional tracks divide what remains. section 1.2.1 section 4.3.3

Accounting for the box model

For an 800px-wide container with a 200px fixed column, two 30px gaps, 6px borders, and 15px padding, the remaining space is 498px. With tracks of 2fr and 1fr, the columns become 332px and 166px. Padding and borders must be subtracted before distributing fractional space. section 4.3.3

.container {
    display: grid;
    grid-template-columns: 200px 2fr 1fr;
    gap: 30px;
    border: 6px solid black;
    padding: 15px;
    width: 800px;
}

Inspect the CSS Grid declaration that produces one fixed track, two fractional tracks, fixed gaps, borders, padding, and an explicit container width. section 4.3.3

How Math for Web Design covers it

How deep it goes
Calculates fractional track sizes after subtracting fixed tracks, gaps, borders, and padding.
Examples
Demonstrates an 800px CSS Grid container with fixed tracks, fractional tracks, gaps, borders, and padding.
What you can do after
Apply it via CSS Grid by calculating fractional columns from the container's true available space.
How it connects
Connects grids with the box model, spacing, responsive breakpoints, typography, and visual composition.

Also explained in

Compare how 8 books explain grid →

Related concepts

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