Skip to main content
Module 8 · Lesson 1 of 429/60 in the course~20 min
Module lessons (1/4)

Grid Foundations: display: grid, fr Tracks & Gaps

Lesson preview5 hands-on exercises readyModern HTML & CSS · CSS Grid Layout & Subgrid

Define explicit column tracks with fr units, implicit auto rows, and consistent grid gaps.

What you'll learn in this lesson

  • Activate 2D CSS Grid containers with display: grid and define explicit columns using grid-template-columns.
  • Size fluid fractional columns cleanly with fr units (avoiding % + gap overflow bugs) and control row vs column spacing with gap.
  • Understand explicit vs implicit grid tracks (grid-auto-rows).

Overview

Flexbox calculates each row independently based on content width. CSS Grid establishes an architectural blueprint on the parent container first, defining column and row lines before items slot in.

Switch between 3 equal fr tracks, fixed+fluid sidebar tracks, and auto-fit, then drag the container width slider:

Sections covered in this lesson

  1. 1When Flexbox Is 1D, CSS Grid Is 2D
  2. 2Inspect Grid Tracks & Column Lines Live
Pro Lesson · CSS Grid Layout & Subgrid

Unlock "Grid Foundations: display: grid, fr Tracks & Gaps" and the full Modern HTML & CSS curriculum

Define explicit column tracks with fr units, implicit auto rows, and consistent grid gaps.

Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.

  • Instant access to all advanced modules in Modern HTML & CSS plus 17 more courses
  • Hands-on browser exercises with automated test suites and solutions
  • 14-day money-back guarantee processed via Paddle.com

14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.