HTML & CSS · Grid Layout · Lesson 16 of 25
Responsive Grids with auto-fit
Concept
Responsive Grids with auto-fit
repeat(auto-fit, minmax(200px, 1fr)) creates a grid that automatically adds or removes columns based on available space.
This single line replaces what would otherwise require several media queries — the browser recalculates the column count itself as the container resizes.
- Explain the core idea behind Responsive Grids with auto-fit.
- Predict output before running a change.
- Test one realistic and one unusual input.
- Use the result to make the next decision.
- 1. Read one concept.
- 2. Change the example.
- 3. Run, compare, and explain.
- 4. Complete the challenge below.
Self-check before continuing
Without looking at the example, describe what changes when you modify one input in Responsive Grids with auto-fit. Then reopen the editor and prove your explanation with a small test.
You are ready to continue when you can predict, test, and explain the result.
Your turn
Build a card grid that reflows from 3 columns down to 1 as the screen narrows.
Ask about this lesson or your next move. The guide explains the path without taking the work away from you.
Ready for the next lesson?
Mark this lesson complete when you have finished the exercise.
Console