Skip to content
tezvyn:

Explicit vs implicit grid: how do you control implicit tracks?

Source: developer.mozilla.orgMediumHow cards are made

Explicit vs implicit grid: how do you control implicit tracks?
Summary

Grid track generation beyond explicit bounds.

Key points

Explicit tracks use grid-template; implicit tracks appear on overflow. Control via grid-auto-rows/columns and grid-auto-flow.

What's really being asked

This question probes whether you understand the boundary between declared grid structure and runtime track generation in CSS Grid. Seniors should know that grid-template-rows and grid-template-columns only set up the explicit grid, while the browser may silently create additional tracks when items are placed outside those bounds or when auto-placement overflows the defined area. It also checks if you know the specific properties that govern those generated tracks.

The full answer

First, define the explicit grid as the tracks created by grid-template-rows and grid-template-columns. Second, explain that the implicit grid consists of any extra rows or columns the browser auto-generates to hold items that do not fit inside the explicit bounds, such as when an item uses grid-column span 2 or grid-row 5 in a four-row grid. Third, state that implicit track sizing is controlled with grid-auto-rows and grid-auto-columns, which accept any track sizing value like 100px, 1fr, or minmax(100px, auto). Fourth, mention that grid-auto-flow determines how auto-placed items fill those implicit tracks, distinguishing between row and column dense packing.

The mistakes people make

A common mistake is confusing implicit tracks with auto-fit or auto-fill inside a repeat function, which are explicit track strategies that collapse empty tracks rather than generate new ones. Another red flag is claiming that items outside the explicit grid simply overflow the container like absolutely positioned elements, when in fact the grid container expands to contain them. Some candidates also forget grid-auto-columns entirely and only mention grid-auto-rows, revealing shallow experience with horizontal overflow scenarios.

What usually comes next

An interviewer might ask how grid-auto-flow dense changes item ordering, or when implicit tracks become a performance concern with large datasets. They may also ask you to compare minmax in explicit tracks versus sizing implicit tracks, or how auto-fit differs from simply letting implicit tracks handle responsiveness.

A concrete example

Imagine a container with display grid and grid-template-columns set to repeat(3, 1fr), creating three explicit columns. If a child item has grid-column set to 4, the browser creates an implicit fourth column. Without grid-auto-columns, that new column defaults to auto width, but setting grid-auto-columns to 200px forces every implicitly created column to be exactly two hundred pixels wide. Similarly, if you place fifty items in a grid with only grid-template-rows set to repeat(2, 100px), the first two rows are explicit and the next forty-eight are implicit; grid-auto-rows set to 80px would size all overflow rows at eighty pixels each.

Interview question

Which properties size tracks the browser generates when items are placed outside the explicit grid?

  • a.grid-auto-flow and grid-auto-rows
  • b.grid-template-rows and grid-template-columns
  • c.grid-auto-rows and grid-auto-columnsCorrect
  • d.auto-fit and auto-fill
Why?

grid-auto-rows and grid-auto-columns define the dimensions of implicitly created tracks outside the explicit grid. auto-fit and auto-fill are repeat strategies that collapse empty explicit tracks rather than generate new implicit ones.

Just read this? Test yourself on what you have been reading.

Read the original → developer.mozilla.org

You just looked this up. Could you explain it out loud?

That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on css — each one lists the topics its interview covers.

See open roles