The magic of auto-fit and auto-fill (and the difference between them) @KevinPowell
The magic of auto-fit and auto-fill (and the difference between them)  @KevinPowell
Uploaded November 2025 | Updated November 2026, 12 hours ago
Grid's auto-fit and auto-fill are super useful, and while the declaration is pretty long, and can seem complicated, it's not so bad once you break it down.

βœ… Auto-fill vs. auto-fit demo: codepen.io/kevinpowell/pen/yyLYoZO
βœ… More on getting started with Grid: youtu.be/rg7Fvvl3taU

βœ‰ Keep up to date with everything I'm up to kevinpowell.co/newsletter
πŸ’¬ Come hang out with other devs in my Discord Community discord.gg/nTYCvrK
⭐ Are you a beginner? HTML & CSS for absolute beginners is for you: learn.kevinpowell.co
πŸŽ“ Start writing CSS with confidence with CSS Demystified: [https://cssdemystified.com](https://cssdemystified.com/)
πŸš€ Already mastered CSS? Check out my advanced course, Beyond CSS: https://www.beyondcss.dev/

#css

⌚ Timestamps
00:00 - Introduction
00:25 - The basics of grid columns
02:30 - Using the repeat syntax
03:15 - Breaking down repeat auto-fit
05:45 - Preventing overflow
08:00 - Use a variable for the minimum value
08:45 - How to remember this declaration
11:25 - The difference between auto-fit and auto-fill

---

Help support my channel
πŸ‘¨β€πŸŽ“ Get a course: kevinpowell.co/courses
πŸ‘• Buy a shirt: cottonbureau.com/people/kevin-powell
πŸ’– Support me on Patreon: patreon.com/kevinpowell or through YT memberships: youtube.com/@KevinPowell/join

---

πŸ§‘β€πŸ’» My editor: VS Code - code.visualstudio.com

🌈 My theme: One Dark Pro Var Night
πŸ”€ My font: Cascadia Code

---

I'm on some other places on the internet too!

If you'd like a behind the scenes and previews of what's coming up on my YouTube channel:

Bluesky: https://bsky.app/profile/kevinpowell.co
Codepen: codepen.io/kevinpowell
Github: github.com/kevin-powell

---

And whatever you do, don't forget to keep on making your corner of the internet just a little bit more awesome!
The magic of auto-fit and auto-fill (and the difference between them)z-index animation fixF1 Website ChampionshipI wish this had always been so easyIs HTML the hardest language?Do we really need alpha()?Dark mode images without a media queryIt might be time to rethink box-sizing: border-boxHandy CSS layout patterns, and fun ways to elevate themCSS style queries in actionEven more ways to center a divBuild modals in minutes with the dialog element
Kevin Powell |

The magic of auto-fit and auto-fill (and the difference between them)

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER