liveBook · Manning

Grid-auto-rows

As explained in CSS in Depth, Second Edition

The CSS grid-auto-rows property specifies the size of implicitly created grid rows.

grid-auto-rows sets the size of rows that CSS Grid creates implicitly when placed items extend beyond the declared grid. These rows default to auto, growing to contain their contents. section 5.4

Use it when the number of grid rows should adapt to changing content:

  • Declare columns with grid-template-columns while allowing additional image rows to appear automatically. section 5.4
  • Set grid-auto-rows: 1fr to give every implicitly created row the specified fractional track size. section 5.4

Responsive photography portfolio

A portfolio can combine grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) with grid-auto-rows: 1fr. As figures wrap onto new lines, CSS Grid adds rows without requiring a fixed number of images. section 5.4

How CSS in Depth, Second Edition covers it

How deep it goes
Defines the auto default and demonstrates an explicit 1fr value in an adaptable portfolio, without detailing track-sizing internals.
Examples
Uses a photography portfolio containing figures, images, captions, featured items, and rows added as images wrap.
What it assumes
Assumes familiarity with CSS Grid containers and explicit tracks while establishing how implicit tracks arise from item placement.
What you can do after
Apply it to build adaptable CSS Grid layouts whose automatically created rows follow a chosen size.
How it connects
Connects implicit grid rows with explicit grid tracks, grid-template-columns, grid-auto-columns, and responsive image layouts.

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.