liveBook · Manning

Explicit track creation

As explained in Math for Web Design

An explicit track is a CSS Grid row or column directly defined by grid-template-columns or grid-template-rows.

Explicit tracks are the rows and columns declared directly with grid-template-columns or grid-template-rows. They establish the grid’s planned structure before item placement, giving Grid known lines and track sizes to work from. section 4.3

This distinction matters when a layout grows. Tracks created because an item is placed beyond the declared grid, or because Grid needs room for more items, are implicit. The sizing algorithm first identifies both kinds, then resolves intrinsic sizes, content constraints, and any remaining fr space. section 4.3

Create tracks explicitly when the layout needs dependable structure:

  • Define known columns or rows with grid-template-columns and grid-template-rows. section 4.3
  • Use negative line numbers such as -1 to place an item relative to the grid’s end; negative numbering exists only for explicit tracks. section 4.2.3
  • Declare rows instead of relying on grid-auto-rows when an item must occupy the final row with grid-row: -2 / -1. section 4.5

A full-width title that survives column changes

For a title or caption spanning a table-like grid, use grid-column: 1 / -1. Line 1 starts the explicit grid and -1 selects its final line, so the item continues to span every declared column even when the column count changes. section 4.2.3

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 200px 200px 200px 100px;
}

Declaring four rows makes their ending lines explicit, allowing a footer or total row to target the last row with negative grid lines. section 4.5

Explicit tracks also make sizing easier to reason about. Fixed sizes, intrinsic keywords, minmax(), and fr units are resolved as part of the track-sizing process; fr space is distributed only after fixed tracks, gaps, padding, and borders are accounted for. section 4.3 section 4.5

Practical takeaway: declare the grid structure whenever placement depends on stable line references. Let Grid add implicit tracks for overflow or automatic placement, but do not expect those tracks to support negative indices. section 4.2.3 section 4.6

How Math for Web Design covers it

How deep it goes
Defines explicit versus implicit tracks and traces their role in the sizing algorithm, deferring later algorithm details.
Examples
Uses full-width title and total rows, explicit fixed rows, proportional fr calculations, and responsive gallery declarations.
What you can do after
Apply it by declaring rows or columns when negative-line placement requires stable grid boundaries.
How it connects
Connects explicit tracks to implicit tracks, negative grid lines, grid-template properties, fr units, and minmax().

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.