Cyber Code Academy
Tutorials Academy Courses
Home / CSS / CSS Grid Basics

CSS Grid Basics

Create a grid

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

Responsive grid

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 1rem;
}

Grid is useful for rows and columns together. The auto-fit pattern can fit as many columns as the container allows.

Practice

Make a responsive grid of learning cards that adapts from desktop to mobile.

Want to learn this professionally?

Explore practical IT training at Cyber Code Academy.

View Academy Courses