Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

How to Set Max-Columns Using Auto-fit or Auto-fill in CSS Grid

Kevin Powell via YouTube

Overview

Coursera Flash Sale
40% Off Coursera Plus for 3 Months!
Grab it
Learn how to control the maximum number of columns in CSS Grid layouts using auto-fit or auto-fill in this 17-minute tutorial. Discover techniques to set upper limits on column creation through calc() functions, making your grid layouts more predictable and responsive. The video walks through a basic auto-fit setup, demonstrates the necessary mathematical calculations, improves code readability, implements responsive stacking for smaller screens, prevents overflow issues, and introduces an advanced technique using newer CSS features. Complete with code examples and practical demonstrations, this tutorial provides everything needed to master grid column management for more flexible and controlled layouts.

Syllabus

00:00 - Introduction
00:50 - Basic setup with auto-fit
03:00 - Having to do some math to make it work
05:28 - Making it more readable
06:30 - Making it stack at smaller sizes
09:10 - Preventing overflow
12:54 - An improvement we can make with a new CSS feature

Taught by

Kevin Powell

Reviews

Start your review of How to Set Max-Columns Using Auto-fit or Auto-fill in CSS Grid

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.