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

flexbox · the one-dimensional layout

FlexboVSThe Float Phantom
Flexbo saysFlexbox lays out items in one dimension — a row or a column — with powerful alignment.

Set display:flex on a container and its children become flex items laid along the main axis (a row by default). Flexbox excels at distributing space and aligning items, making it the go-to for navbars, toolbars, centering, and any one-dimensional arrangement.

Power-ups you unlock

The Float Phantom attacks — common mistakes

Boss battleMake a row of three boxes with display:flex and a gap.

Example code

<!doctype html><html><head><meta charset="utf-8">
<style>.row{display:flex;gap:10px}.row div{background:#b388ff;color:#06040d;padding:14px;flex:1;text-align:center}</style></head><body style="background:#06040d;padding:20px"><div class="row"><div>a</div><div>b</div><div>c</div></div></body></html>
▶ Open the interactive comic issue
‹ Cursor · Pointer · Grab · CustomFlex Container · Direction · Wrap · Gap ›