Grid with utilities
Build two-dimensional layouts with grid-cols, spans and auto-fit patterns.
What you will be able to do
- Use grid and gap for the base.
- Use col-span-* to place items across columns.
- Use auto-fit with minmax for card grids.
- Keep the DOM order meaningful when reordering visually.
In plain English
Grid is for layouts that need rows and columns at the same time. Use grid-cols-12 for bespoke layouts and grid-cols-[repeat(auto-fit,minmax(...))] for responsive card walls without media queries.
<div class="grid grid-cols-1 gap-4 md:grid-cols-3">
<article class="rounded-xl border border-slate-200 p-4">HTML</article>
<article class="rounded-xl border border-slate-200 p-4">CSS</article>
<article class="rounded-xl border border-slate-200 p-4">JavaScript</article>
</div>Your turn
MediumMake a responsive card wall
Create a grid with auto-fit tracks at least 200px wide and a gap of 4.
HTML · starter
<div class="grid gap-4">Check your understanding before moving on.
Knowledge checkQuestion 1
Which class makes one column on mobile and three from md up?
Select an answer to continue
Study tools
Make it yours.
Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.
Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign inFinished reading?
Lock in what you just learned.
0%
Mark this lesson complete to save your place and move one step closer to the certificate.