0
0
Tailwindmarkup~20 mins

Flex direction control in Tailwind - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Flex Direction Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
rendering
intermediate
2:00remaining
What is the visual order of items with flex-row-reverse?
Given this HTML and Tailwind CSS, what is the order of the boxes from left to right as seen in the browser?

<div class="flex flex-row-reverse gap-4">
  <div class="w-12 h-12 bg-red-500">1</div>
  <div class="w-12 h-12 bg-green-500">2</div>
  <div class="w-12 h-12 bg-blue-500">3</div>
</div>
Tailwind
<div class="flex flex-row-reverse gap-4">
  <div class="w-12 h-12 bg-red-500">1</div>
  <div class="w-12 h-12 bg-green-500">2</div>
  <div class="w-12 h-12 bg-blue-500">3</div>
</div>
A2, 3, 1
B1, 2, 3
C3, 1, 2
D3, 2, 1
Attempts:
2 left
💡 Hint
Remember that flex-row-reverse reverses the horizontal order of flex items.
selector
intermediate
1:30remaining
Which Tailwind class sets vertical stacking of flex items?
You want your flex container to stack items vertically from top to bottom. Which Tailwind CSS class should you use?
Aflex-row
Bflex-col
Cflex-row-reverse
Dflex-col-reverse
Attempts:
2 left
💡 Hint
Think about the direction of the main axis in flexbox.
🧠 Conceptual
advanced
2:00remaining
What happens if you combine flex-col and flex-row on the same element?
Consider this HTML:

<div class="flex flex-col flex-row">...</div>

What is the effective flex direction applied by Tailwind CSS?
Aflex direction is row because the last class overrides the previous
Bflex direction is row-reverse by default
Cflex direction is a mix of row and column causing layout errors
Dflex direction is column because the first class takes precedence
Attempts:
2 left
💡 Hint
Tailwind applies classes in the order they appear in the class attribute, with later classes overriding earlier ones.
layout
advanced
2:00remaining
How does flex-col-reverse affect vertical stacking?
Given this HTML:

<div class="flex flex-col-reverse gap-2">
  <div>A</div>
  <div>B</div>
  <div>C</div>
</div>

What is the vertical order of the items from top to bottom as seen in the browser?
Tailwind
<div class="flex flex-col-reverse gap-2">
  <div>A</div>
  <div>B</div>
  <div>C</div>
</div>
AC, B, A
BA, B, C
CB, C, A
DC, A, B
Attempts:
2 left
💡 Hint
The -reverse suffix reverses the normal stacking order.
accessibility
expert
2:30remaining
Which flex direction is best for screen readers to read content in natural order?
You have a navigation menu with items arranged using flexbox. For best accessibility and natural reading order by screen readers, which flex direction should you use?
Aflex-col-reverse
Bflex-row-reverse
Cflex-row
Dflex-col
Attempts:
2 left
💡 Hint
Screen readers read content in the order it appears in the HTML source.