37:44How to set max-columns using auto-fit or auto-fill
From the creator
It takes a little bit of work, but we can relatively easily take control of CSS Grid’s auto-fit (or auto-fill) by using a `calc()` to help set an upper limit on how many columns it creates. 🔗 Links ✅ The code from this video: https://codepen.io/kevinpowell/pen/GgRwqxJ ✅ The second version using attr(): https://codepen.io/kevinpowell/pen/ZYEBEre ✅ auto-fit and auto-fill explained: https://www.youtube.com/watch?v=bj0Z_GncIwY ✅ I’ve got free and premium courses: https://kevinpowell.co/courses ⌚ Timestamps 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 #css ✉ Keep up to date with everything I'm up to https://www.kevinpowell.co/newsletter 💬 Come hang out with other devs in my Discord Community https://discord.gg/nTYCvrK ⭐ Are you a beginner? HTML & CSS for absolute beginners is for you: https://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/ --- Help support my channel 👨🎓 Get a course: https://www.kevinpowell.co/courses 👕 Buy a shirt: https://cottonbureau.com/people/kevin-powell 💖 Support me on Patreon: https://www.patreon.com/kevinpowell or through YT memberships: https://youtube.com
Published 2025-04-09 · Watch on YouTube ↗
Availability and playback restrictions are controlled by the original channel.





