CSS Academy · Lesson

Implicit Grid and Grid-Auto-Flow

Understand how CSS Grid handles items beyond explicit tracks with implicit rows and columns.

Lesson 3 of 413 steps

Implicit Grid and Grid-Auto-Flow is a free CSS Academy lesson on CoddyKit. This is lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the CSS Academy learning path, and your progress syncs across the web and the CoddyKit app. The CSS Academy course includes 4 lessons in total.

Explicit vs Implicit Grid

The explicit grid is defined by grid-template-columns and grid-template-rows. When items overflow beyond these defined tracks, the browser creates implicit tracks automatically.

grid-auto-rows

Defines the size of implicitly created row tracks. Without it, implicit rows are sized to fit their content (auto).

  <div class="gallery">
    <div>1</div><div>2</div><div>3</div><div>4</div>
  </div>

grid-auto-rows with minmax

Make implicit rows at least a certain height but expandable:

  <div class="feed">
    <div>1</div><div>2</div><div>3</div>
  </div>

grid-auto-columns

Defines implicit column track sizes when items are placed outside the explicit column range:

  <div class="timeline">
    <div>Event 1</div><div>Event 2</div>
  </div>

grid-auto-flow

Controls how the auto-placement algorithm places items:

  • row (default) — place in rows, adding new rows as needed
  • column — place in columns, adding new columns
  • row dense — fill gaps aggressively by backtracking
  • column dense — dense filling in column direction

grid-auto-flow: dense

dense makes the algorithm attempt to fill holes left by large-spanning items. This can cause items to appear out-of-order.

  <div class="masonry">
    <div class="featured">Featured</div><div>2</div><div>3</div><div>4</div>
  </div>

Auto-flow Column Pattern

Horizontal scrolling card strip where columns grow as needed:

  <div class="strip">
    <div>Card 1</div><div>Card 2</div><div>Card 3</div>
  </div>

Dense Packing for Gallery

A photo gallery with mixed sizes that fills gaps:

  <div class="gallery">
    <div class="wide">Wide</div>
    <div class="tall">Tall</div>
    <div>3</div><div>4</div>
  </div>

Implicit Grid and Named Areas

Named areas only apply to the explicit grid. Items placed in the implicit grid cannot use named area placement directly — they require line-number or span placement.

Visualizing the Implicit Grid

In Chrome DevTools, the layout overlay shows both explicit (solid) and implicit (dashed) grid lines. This helps you understand where auto-placed items land.

Controlling Implicit Size per Item

Items spanning multiple rows in the implicit grid need grid-auto-rows to size correctly. Without it, implicit rows size to content which can create uneven layouts.

Quick Check

What does grid-auto-flow: row dense do?

Recap

The implicit grid extends the explicit grid with auto-created tracks. grid-auto-rows/columns controls their size; minmax() makes them flexible. grid-auto-flow directs placement direction. dense packing fills gaps aggressively — useful for masonry-style layouts but may break visual order.

Free to start

Learn CSS with an AI tutor — free

Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.

Courses
40
Lessons
159

Frequently Asked Questions

Is the “Implicit Grid and Grid-Auto-Flow” lesson free?

Yes — the full text of “Implicit Grid and Grid-Auto-Flow” is free to read here on the web. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the CSS Academy course, upgrade to CoddyKit PRO. The CSS Academy course includes 4 lessons in total.

What will I learn in “Implicit Grid and Grid-Auto-Flow”?

Understand how CSS Grid handles items beyond explicit tracks with implicit rows and columns. You practise CSS Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start CSS Academy?

No prior experience is required. CSS Academy on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 3 of 4.

How long does the “Implicit Grid and Grid-Auto-Flow” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this CSS Academy lesson?

Yes. Every CSS Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Named Lines and Named Grid Areas
  2. Auto-fit and Auto-fill with minmax
  3. Implicit Grid and Grid-Auto-Flow
  4. Subgrid for Aligned Nested Content
← Back to CSS Academy