Lazo Lab Sign up

Web Development / CSS

Lesson 13 of 30

CSS Grid

Grid lays things out in rows and columns at the same time. repeat(auto-fill, minmax(220px, 1fr)) makes a responsive card grid in one line.

Key points

  • display: grid
  • grid-template-columns
  • fr shares out free space
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
Watch a video on thisOpens YouTube search results for “CSS Grid” in a new tab

Quiz · +10 XP

What does 1fr mean in a grid?

Log in to save progress and earn XP.