06.04 · Layout with Flexbox / Learn + practice · 8 guided steps
Share space with grow, shrink and basis
Measure the difference between sharing spare space and giving space back when a row is too small.
Activity 4 of 5 in Layout with Flexbox
CSS Basics / 06.04
Share space with grow, shrink and basis
Not started
Measure the difference between sharing spare space and giving space back when a row is too small.
Your lesson progress
Empty: not started. Yellow: in progress. Green: complete. Marking the whole activity complete does not replace your test results. These circles save in this browser for this pilot.

Read the three parts of flex
The shorthand flex: 1 1 0 means grow by 1, shrink by 1, with a zero starting basis. Grow factors share positive free space. With equal zero bases and no item padding or border, factors 1, 2, 1 produce widths in that ratio.
flex-basis is a starting main-axis size, not a promise of the final width. With nonzero bases, the final widths need not match the grow-factor ratio. Shrinking is weighted by the item bases, so shrink factors are not simple final-width ratios either.
Watch the measured widths
Start with a zero basis and a middle grow factor of 2. The middle panel receives two shares while the outside panels receive one each. Switch to 120px or 240px bases and compare the measured widths. Reduce the container width and toggle shrinking. If shrinking is off, the preview may need horizontal scrolling.
Change the middle grow factor, starting basis and shrink behavior. The labels show measured item widths.
The changed declaration is highlighted. These controls do not edit or save your workshop code.
Main axis: left to right. Cross axis: top to bottom.
Content can set a lower limit
Flex items normally have an automatic minimum size. A long unbroken label may prevent the item from shrinking enough. min-width: 0 lets it become narrower, and overflow-wrap: anywhere lets a long label wrap. Use these deliberately when content should wrap rather than simply hiding overflow.
Build it one step at a time
Work through 8 small stages in the on-site editor. Read the instruction, make the requested change and run its checks. Your HTML and CSS carry forward; the preview updates as you type.
The workshop opens in a new tab. Your own code carries forward; each step has a focused check and an optional hint.
Start workshop(opens in a new tab)8 steps · Saved work · Instant feedback
Keep useful documentation nearby
You do not need to memorize every property value. Read the task, predict the result, then use documentation to check your understanding.
Ready to try it?
Practice in your browser and see your results.
Progress details
Have a question?
Ask the Code Zone community.
Ask a question in The Code Zone (opens in a new tab)Continue learning

7 days freeTry The Code Zone
THE CODE ZONE COMMUNITY
Your next step is easier together.
Try the community free for 7 days.
No charge during your trial. Choose your plan on Skool.
- Ask questions and get support in the community
- Watch every course video walkthrough
- Find a study buddy in the 24/7 study room
Make the most of your trial with Premium.
Choose Premium on Skool to try Thursday live help sessions. Bring your questions, work through code, and get unstuck together.
Scheduled Thursdays in Eastern Time. Check the Skool calendar for your local date and time.
Have a website account? Sign in