In this lesson, you tested what Rosa’s pool cards take from the pool list’s grid, one DevTools experiment at a time, with the Grid overlay on and the device toolbar at 1280 pixels. DevTools edits last only until the page reloads, so your files don’t change.
Key Points
- A subgrid gets exactly the tracks its item spans in the parent grid. Each pool card spans three rows, so its subgrid has three rows.
- Only the subgrid’s own children sit on those tracks. A badge isn’t the card’s child but its grandchild, so
grid-row: 1on the badges moves nothing. Their parent, the badge list, is a flex container that lays them out on its own. - Line names come down with the tracks. In
[name] auto [times] auto [badges] auto, each name in brackets names the line that starts the row after it, andautois that row’s size. A card defines no names of its own, yetgrid-row: nameplaces its badges at the list’s line calledname. The name and times, with no row set, then fill the free rows after it, in order. - The gap comes down too. The card sets no gap, yet the space between its name and its times is the list’s 18-pixel row gap. A
row-gapon the card overrides it inside every card. With--space-control-block, the small space the badges use between them, the gap drops to 9 pixels. - In its subgridded direction, a subgrid adds no tracks. A fourth child in a card that spans three rows finds no free row left, so it shares the last one, on top of the badges. This short note doesn’t make the card grow. Longer text would make that shared row taller, but never add a fourth.
- When you write a subgrid, count the tracks the item spans and its children. More children than tracks, and the extras share the last one.
The Experiments
Each of these was added in the Styles pane, not in styles.css: