0
0
Tailwindmarkup~20 mins

Justify content (main axis) in Tailwind - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Justify Content Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
layout
intermediate
2:00remaining
What is the visual result of justify-center in Tailwind CSS?
You have a flex container with three boxes inside. The container uses flex and justify-center. Where will the boxes appear horizontally inside the container?
Tailwind
<div class="flex justify-center bg-gray-100 h-24">
  <div class="w-12 h-12 bg-blue-500"></div>
  <div class="w-12 h-12 bg-red-500"></div>
  <div class="w-12 h-12 bg-green-500"></div>
</div>
AThe three boxes are grouped together in the center horizontally with equal space on left and right.
BThe three boxes are spaced evenly with equal space between each box and edges.
CThe three boxes are aligned to the left side with no extra space on the right.
DThe three boxes are aligned to the right side with no extra space on the left.
Attempts:
2 left
💡 Hint
Think about how justify-content works on the main axis in flexbox.
layout
intermediate
2:00remaining
Which Tailwind class spaces flex items evenly with equal space around each item?
You want to create a flex container where the items have equal space before the first item, between items, and after the last item. Which justify-* class do you use?
Tailwind
<div class="flex justify-??? bg-gray-100 h-24">
  <div class="w-12 h-12 bg-purple-500"></div>
  <div class="w-12 h-12 bg-yellow-500"></div>
  <div class="w-12 h-12 bg-pink-500"></div>
</div>
Ajustify-around
Bjustify-between
Cjustify-center
Djustify-start
Attempts:
2 left
💡 Hint
Remember, justify-around adds equal space around each item, including edges.
selector
advanced
2:00remaining
Which Tailwind class aligns flex items to the end of the main axis?
You want all flex items to be pushed to the right side of a horizontal flex container. Which justify-* class achieves this?
Tailwind
<div class="flex justify-??? bg-gray-100 h-24">
  <div class="w-12 h-12 bg-red-400"></div>
  <div class="w-12 h-12 bg-green-400"></div>
  <div class="w-12 h-12 bg-blue-400"></div>
</div>
Ajustify-between
Bjustify-end
Cjustify-center
Djustify-start
Attempts:
2 left
💡 Hint
Think about which side is the 'end' in a left-to-right flex container.
🧠 Conceptual
advanced
2:00remaining
What happens if you use justify-between with only one flex item?
You have a flex container with a single item inside. The container uses flex and justify-between. How will the single item be positioned horizontally?
Tailwind
<div class="flex justify-between bg-gray-100 h-24">
  <div class="w-12 h-12 bg-indigo-500"></div>
</div>
AThe single item is centered horizontally.
BThe single item is placed at the end (right) of the container.
CThe single item stretches to fill the container width.
DThe single item is placed at the start (left) of the container.
Attempts:
2 left
💡 Hint
Consider how justify-between distributes space between multiple items.
accessibility
expert
3:00remaining
How does using justify-center affect keyboard navigation and screen reader users?
You have a flex container with buttons aligned using justify-center. What should you consider to ensure good accessibility?
Tailwind
<nav class="flex justify-center bg-gray-50 p-4" role="navigation" aria-label="Main menu">
  <button class="mx-2">Home</button>
  <button class="mx-2">About</button>
  <button class="mx-2">Contact</button>
</nav>
AScreen readers will ignore buttons because they are centered; keyboard navigation is disabled.
BKeyboard users will be trapped in the center; screen readers will read buttons in visual order only.
CKeyboard users can tab through buttons in order; screen readers read buttons in DOM order regardless of visual alignment.
DButtons must have extra ARIA roles to be accessible when centered.
Attempts:
2 left
💡 Hint
Think about how visual layout affects DOM order and accessibility.