freecoding.school100% FREE · NO SIGNUP
Grid CanyonISSUE #17 of 27

grid container · gap · auto-rows

FlexboVSThe Float Phantom
Flexbo saysgap spaces grid tracks; auto-fit/auto-fill with minmax build responsive grids with no media queries.

gap sets row and column spacing. The responsive magic is grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) — it fits as many ≥200px columns as the width allows, reflowing automatically. One line replaces a stack of media queries.

Power-ups you unlock

The Float Phantom attacks — common mistakes

Boss battleMake a card gallery that reflows columns automatically using auto-fit + minmax.

Example code

<!doctype html><html><head><meta charset="utf-8">
<style>.g{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:10px}.g div{background:#b388ff;color:#06040d;padding:18px;text-align:center}</style></head><body style="background:#06040d;padding:20px"><div class="g"><div>1</div><div>2</div><div>3</div><div>4</div><div>5</div></div></body></html>
▶ Open the interactive comic issue
‹ Grid Container · Template-Columns · Template-RowsGrid Items · Column / Row Span ›