Challenge - 5 Problems
Masonry Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ layout
intermediate2:00remaining
What is the visual effect of this Tailwind CSS grid code?
Consider this Tailwind CSS snippet for a grid container:
What will the grid layout look like when items have different heights?
class="grid grid-cols-3 gap-4 auto-rows-min"
What will the grid layout look like when items have different heights?
Attempts:
2 left
💡 Hint
Think about how 'auto-rows-min' affects row height in a grid.
✗ Incorrect
The 'auto-rows-min' sets the minimum row height, but all rows in a grid have the same height per row line. So each row's height matches the tallest item in that row, not individual items. This means no masonry effect.
❓ selector
intermediate2:00remaining
Which Tailwind utility enables a masonry-style column layout?
You want to create a masonry-style grid with columns that flow vertically and items stacked unevenly. Which Tailwind CSS utility class helps achieve this?
Attempts:
2 left
💡 Hint
Masonry layouts often use CSS columns, not grid columns.
✗ Incorrect
The 'columns-3' utility creates CSS columns that flow vertically, stacking items in a masonry style. 'grid-cols-3' creates grid columns but does not produce masonry.
🧠 Conceptual
advanced2:30remaining
Why does a CSS Grid not create a true masonry layout by default?
Given a CSS Grid container with multiple columns and items of varying heights, why does it not produce a masonry effect where items stack vertically without gaps?
Attempts:
2 left
💡 Hint
Think about how grid rows behave in height.
✗ Incorrect
CSS Grid defines rows that span the full width, so all items in a row share the same height. This prevents items from stacking unevenly vertically like masonry.
❓ rendering
advanced2:30remaining
What is the rendered output of this Tailwind CSS snippet?
Given this HTML and Tailwind CSS:
How will the items be arranged visually?
<div class="columns-2 gap-4"> <div class="bg-blue-300 p-4">Short</div> <div class="bg-green-300 p-4 h-32">Tall</div> <div class="bg-red-300 p-4">Medium height</div> </div>
How will the items be arranged visually?
Attempts:
2 left
💡 Hint
CSS columns flow vertically, stacking items unevenly.
✗ Incorrect
The 'columns-2' class creates two CSS columns. Items flow vertically filling the first column top to bottom, then the second column, producing a masonry effect with uneven heights.
❓ accessibility
expert3:00remaining
How to ensure keyboard accessibility in a masonry-style grid using CSS columns?
When using CSS columns (e.g., Tailwind's 'columns-3') for a masonry layout, what is a key accessibility concern for keyboard users?
Attempts:
2 left
💡 Hint
Think about how DOM order and visual order differ in CSS columns.
✗ Incorrect
CSS columns flow content vertically per column, but DOM order is linear top to bottom. Keyboard navigation follows DOM order, which may not match visual reading order, confusing users.