Challenge - 5 Problems
Order and Self-Alignment Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ layout
intermediate2:00remaining
What is the visual order of items with Tailwind's order classes?
Given this HTML with Tailwind CSS classes, what is the order in which the items appear visually?
<div class="flex"> <div class="order-3">Item 1</div> <div class="order-1">Item 2</div> <div class="order-2">Item 3</div> </div>
Tailwind
<div class="flex"> <div class="order-3">Item 1</div> <div class="order-1">Item 2</div> <div class="order-2">Item 3</div> </div>
Attempts:
2 left
💡 Hint
Remember, lower order values appear first in flex containers.
✗ Incorrect
Tailwind's order utility sets the CSS order property. Items with lower order values appear before those with higher values. Here, order-1 (Item 2) comes first, then order-2 (Item 3), then order-3 (Item 1).
❓ selector
intermediate1:30remaining
Which Tailwind class aligns a single flex item to the end of the cross axis?
You have a flex container with vertical direction. Which Tailwind class should you add to a single item to align it to the bottom (end) of the container?
Attempts:
2 left
💡 Hint
Think about aligning one item, not the whole container.
✗ Incorrect
The 'self-end' class aligns a single flex item to the end of the cross axis. 'items-end' aligns all items, 'justify-end' aligns items along the main axis, and 'content-end' affects multi-line flex containers.
🧠 Conceptual
advanced2:00remaining
What happens if multiple flex items have the same order value in Tailwind?
Consider a flex container where two items have the same order value using Tailwind classes. How does the browser decide their visual order?
Attempts:
2 left
💡 Hint
Think about the default behavior when order values tie.
✗ Incorrect
When multiple flex items share the same order value, the browser displays them in the order they appear in the HTML source code.
❓ rendering
advanced2:30remaining
What is the vertical position of the green box with 'self-center' in this flex container?
Given this code:
Where will the green box appear vertically inside the container?
<div class="flex flex-col h-40 border border-gray-400"> <div class="bg-red-400 h-10">Red</div> <div class="bg-green-400 h-10 self-center">Green</div> <div class="bg-blue-400 h-10">Blue</div> </div>
Where will the green box appear vertically inside the container?
Tailwind
<div class="flex flex-col h-40 border border-gray-400"> <div class="bg-red-400 h-10">Red</div> <div class="bg-green-400 h-10 self-center">Green</div> <div class="bg-blue-400 h-10">Blue</div> </div>
Attempts:
2 left
💡 Hint
Remember flex-col means main axis is vertical; self-center aligns on cross axis.
✗ Incorrect
'flex-col' sets the main axis vertically. 'self-center' aligns the item on the cross axis (horizontal), so the green box is centered horizontally but remains in normal vertical order between red and blue.
❓ accessibility
expert3:00remaining
How does changing order with Tailwind affect keyboard navigation and screen readers?
If you use Tailwind's order utilities to visually reorder flex items, what is the impact on keyboard navigation and screen readers?
Attempts:
2 left
💡 Hint
Think about how assistive technologies read the page structure.
✗ Incorrect
CSS order changes only visual order. Keyboard navigation and screen readers follow the DOM order in the HTML source, which may differ from visual order, potentially causing confusion if not handled carefully.