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

flex items · grow · shrink · basis

FlexboVSThe Float Phantom
Flexbo saysflex-grow, flex-shrink, and flex-basis decide how items size and share free space.

On each item: flex-grow (how greedily it expands), flex-shrink (how readily it shrinks), flex-basis (its starting size). The flex shorthand packs all three — flex:1 means "grow to fill equally". This makes flexible, proportional columns.

Power-ups you unlock

The Float Phantom attacks — common mistakes

Boss battleMake a sidebar (fixed basis) beside a main area (flex:1) that fills the rest.

Example code

<!doctype html><html><head><meta charset="utf-8">
<style>.f{display:flex;gap:10px}.side{flex:0 0 120px;background:#1c1240}.main{flex:1;background:#140a28}.f>div{color:#e6e0ff;padding:16px}</style></head><body style="background:#06040d;padding:20px"><div class="f"><div class="side">sidebar</div><div class="main">flexible main</div></div></body></html>
▶ Open the interactive comic issue
‹ Flex Container · Justify-Content · Align-ItemsFlex Items · Align-Self · Order ›