0
0
Tailwindmarkup~20 mins

Masonry-style grid in Tailwind - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Masonry Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
layout
intermediate
2:00remaining
What is the visual effect of this Tailwind CSS grid code?
Consider this Tailwind CSS snippet for a grid container:
class="grid grid-cols-3 gap-4 auto-rows-min"

What will the grid layout look like when items have different heights?
AA single column layout with items stacked vertically.
BA 3-column grid where rows adjust their height individually to fit each item, creating a masonry effect.
CA 3-column grid where all rows have the same height, matching the tallest item in each row.
DA 3-column grid with fixed row heights, causing overflow if items are taller.
Attempts:
2 left
💡 Hint
Think about how 'auto-rows-min' affects row height in a grid.
selector
intermediate
2: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?
Agrid-cols-3
Bgrid-flow-row
Cflex flex-wrap
Dcolumns-3
Attempts:
2 left
💡 Hint
Masonry layouts often use CSS columns, not grid columns.
🧠 Conceptual
advanced
2: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?
ABecause grid rows are always the same height across the entire row, so items align horizontally.
BBecause grid columns automatically adjust their width to fit items, preventing masonry.
CBecause grid items cannot span multiple rows or columns.
DBecause grid containers do not support gaps between items.
Attempts:
2 left
💡 Hint
Think about how grid rows behave in height.
rendering
advanced
2:30remaining
What is the rendered output of this Tailwind CSS snippet?
Given this HTML and Tailwind CSS:
<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?
AA 2-column grid with rows aligned horizontally, all rows same height as tallest item in that row.
BTwo vertical columns with items stacked top to bottom in each column, uneven heights creating a masonry effect.
CItems stacked vertically in a single column with gaps between them.
DItems arranged horizontally in a single row with equal widths.
Attempts:
2 left
💡 Hint
CSS columns flow vertically, stacking items unevenly.
accessibility
expert
3: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?
AKeyboard users may navigate items out of visual order because DOM order flows top to bottom, left to right visually but columns flow top to bottom per column.
BCSS columns automatically reorder DOM elements to match visual order, so no concern.
CKeyboard users cannot tab through items inside CSS columns.
DScreen readers ignore items inside CSS columns.
Attempts:
2 left
💡 Hint
Think about how DOM order and visual order differ in CSS columns.