Challenge - 5 Problems
Flex Wrap Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ rendering
intermediate2:00remaining
How does
flex-wrap affect item layout?Given a container with
flex and flex-wrap classes, what will happen when the items exceed the container width?Tailwind
<div class="flex flex-wrap w-48 border border-gray-400"> <div class="w-24 h-12 bg-blue-500 m-1"></div> <div class="w-24 h-12 bg-red-500 m-1"></div> <div class="w-24 h-12 bg-green-500 m-1"></div> <div class="w-24 h-12 bg-yellow-500 m-1"></div> </div>
Attempts:
2 left
💡 Hint
Think about what
flex-wrap does compared to the default flex-nowrap.✗ Incorrect
The flex-wrap class allows flex items to move to the next line if they don't fit in one row. Without it, items stay in one line and may overflow or shrink.
❓ selector
intermediate1:30remaining
Which Tailwind class enables wrapping of flex items?
You want your flex container to allow items to wrap onto multiple lines. Which class should you add?
Attempts:
2 left
💡 Hint
Look for the class that explicitly mentions wrapping.
✗ Incorrect
flex-wrap enables wrapping of flex items. flex-nowrap disables wrapping. flex-row and flex-col control direction, not wrapping.
🧠 Conceptual
advanced2:00remaining
What is the default behavior of flex items without
flex-wrap?If you create a flex container but do not add any wrapping class, how will the items behave when they exceed the container width?
Attempts:
2 left
💡 Hint
Think about the default
flex-wrap value in CSS.✗ Incorrect
By default, flex containers have flex-wrap: nowrap. This means items stay on one line and may overflow the container if they don't fit.
❓ layout
advanced2:30remaining
How does
flex-wrap interact with justify-content?You have a flex container with
flex-wrap and justify-center. How will the items be arranged when wrapping occurs?Tailwind
<div class="flex flex-wrap justify-center w-48 border border-gray-400"> <div class="w-24 h-12 bg-purple-500 m-1"></div> <div class="w-24 h-12 bg-pink-500 m-1"></div> <div class="w-24 h-12 bg-indigo-500 m-1"></div> <div class="w-24 h-12 bg-teal-500 m-1"></div> </div>
Attempts:
2 left
💡 Hint
Consider how
justify-content affects each line in a wrapped flex container.✗ Incorrect
When flex-wrap is enabled, justify-content centers items on each wrapped line horizontally.
❓ accessibility
expert3:00remaining
How to ensure keyboard accessibility with wrapped flex items?
You have a flex container with wrapping enabled. What should you do to keep keyboard navigation logical and accessible?
Attempts:
2 left
💡 Hint
Think about how keyboard users navigate content in the order it appears in the HTML.
✗ Incorrect
Keyboard users navigate content in DOM order. If visual wrapping changes order, keep DOM order consistent to avoid confusion.