Give every item a flex-grow of 1.
Acceptance criteria
- 1.Give every item a flex-grow of 1.
CSS Tutorial · CSS Flexbox
These 10 tasks go with the Flex Item Sizing chapter. 5 of them ask you to build something small from scratch; 5 give you code that is already broken and ask you to work out why. Set aside about 90 minutes for the whole set, though you can do them in any order.
Nothing here is marked by a person. When you press Submit, the editor checks your code against the points listed under each task and tells you straight away what passed and what didn't (you need a free account to submit). If you get stuck, there are hints, and a worked solution once you've had a go. The first 2 tasks are free; the rest are part of the practice plan.
If it's been a while since you read the chapter, here is how it starts: “Control how individual flex items grow, shrink, reorder, align, and resolve their size against the available space. It explains flex-basis, positive and negative free space, growth, shrinkage, automatic minimum sizes, per-item alignment, and visual reordering.” .
1.Let items growexercise · easy · 10 min
Give every item a flex-grow of 1.
Passes when: Give every item a flex-grow of 1.
2.Stop an item shrinkingexercise · easy · 10 min · practice plan
Set flex-shrink to 0 on the items.
Passes when: Set flex-shrink to 0 on the items.
3.Set a flex basisexercise · easy · 10 min · practice plan
Give items a 120px basis.
Passes when: Give items a 120px basis.
4.Reorder an itemexercise · easy · 10 min · practice plan
Give the items an order of 2.
Passes when: Give the items an order of 2.
5.Align one item differentlyexercise · medium · 10 min · practice plan
Use align-self to push the items to the end.
Passes when: Use align-self to push the items to the end.
6.Fix flex-grow spelled wrongbug fix · easy · 8 min
The property is flex-grow.
Passes when: The property is flex-grow.
7.Fix grow used where shrink was meantbug fix · easy · 8 min · practice plan
Preventing shrinkage uses flex-shrink: 0.
Passes when: Preventing shrinkage uses flex-shrink: 0.
8.Fix the missing unit on the basisbug fix · easy · 8 min · practice plan
flex-basis needs a unit.
Passes when: flex-basis needs a unit.
9.Fix align-items used on an itembug fix · easy · 8 min · practice plan
An individual item uses align-self.
Passes when: An individual item uses align-self.
10.Fix the order set on the containerbug fix · easy · 8 min · practice plan
order applies to flex items, not the container.
Passes when: order applies to flex items, not the container.
Between them these tasks cover flex-grow, flex-shrink, order and align-self.
Looking for a different chapter? See every practice set, or switch to the interview theory questions.