0
0
Tailwindmarkup~20 mins

Flex basis and sizing in Tailwind - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Flexbox Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding flex-basis in Tailwind CSS
What is the effect of applying flex-basis using Tailwind's basis-1/4 class on a flex item inside a flex container?
Tailwind
<div class="flex">
  <div class="basis-1/4 bg-blue-500">Box 1</div>
  <div class="flex-1 bg-red-500">Box 2</div>
</div>
AThe first box takes up exactly 25% of the container's main axis width, and the second box fills the rest.
BThe first box grows to fill the container, ignoring the 25% basis, and the second box shrinks.
CBoth boxes share the container width equally regardless of basis.
DThe first box shrinks to 25px width, and the second box fills the rest.
Attempts:
2 left
💡 Hint
Remember that basis-1/4 sets the initial size before growing or shrinking.
📝 Syntax
intermediate
1:30remaining
Tailwind class for fixed flex-basis
Which Tailwind CSS class sets a flex item's flex-basis to exactly 10rem?
Abasis-[10rem]
Bbasis-40
Cbasis-10rem
Dbasis-2.5
Attempts:
2 left
💡 Hint
Use square brackets for arbitrary values in Tailwind.
rendering
advanced
2:30remaining
Visual effect of flex-basis with grow and shrink
Given this HTML, what will be the width of the blue box inside a 400px wide container?
Tailwind
<div class="flex w-[400px]">
  <div class="basis-1/2 flex-shrink-0 bg-blue-500">Blue Box</div>
  <div class="flex-1 bg-green-500">Green Box</div>
</div>
AThe blue box will collapse to zero width.
BThe blue box will shrink below 200px to fit the container.
CThe blue box will grow larger than 200px to fill extra space.
DThe blue box will be exactly 200px wide and will not shrink.
Attempts:
2 left
💡 Hint
Check the effect of flex-shrink-0 on the flex item.
selector
advanced
2:00remaining
Selecting flex items by basis size in Tailwind
Which CSS selector targets all flex items with flex-basis set to 25% using Tailwind's basis-1/4 class?
A.basis-1/4
B.basis-1\/4
C[class*=basis-1/4]
D.basis-1-4
Attempts:
2 left
💡 Hint
Remember how Tailwind escapes slashes in class names.
accessibility
expert
3:00remaining
Ensuring accessible flex layouts with basis and sizing
When using flexbox with fixed flex-basis sizes in Tailwind, what is the best practice to maintain accessibility for keyboard users and screen readers?
AAvoid using flexbox and basis sizes; use tables instead for layout.
BSet <code>tabindex="-1"</code> on all flex items with fixed basis to prevent keyboard focus.
CUse semantic HTML elements and ensure focus order matches visual order, regardless of flex-basis sizes.
DAdd ARIA roles to flex items to override default semantics.
Attempts:
2 left
💡 Hint
Think about how keyboard navigation and screen readers follow DOM order.