0
0
Tailwindmarkup~20 mins

Defining grid rows in Tailwind - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Grid Rows Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate
2:00remaining
What is the effect of this Tailwind CSS class?
Consider the following HTML snippet using Tailwind CSS:
<div class="grid grid-rows-3 gap-4">
  <div>Item 1</div>
  <div>Item 2</div>
  <div>Item 3</div>
</div>

What does the grid-rows-3 class do in this example?
Tailwind
<div class="grid grid-rows-3 gap-4">
  <div>Item 1</div>
  <div>Item 2</div>
  <div>Item 3</div>
</div>
AIt creates a grid container with exactly 3 rows, placing each item in its own row.
BIt creates a grid container with 3 columns, placing items horizontally.
CIt adds a 3px gap between rows in the grid.
DIt limits the grid to 3 items total, regardless of content.
Attempts:
2 left
💡 Hint
Think about how grid rows and columns control layout direction.
🧠 Conceptual
intermediate
1:30remaining
How many rows are created by this Tailwind class?
If you use the class grid-rows-4 on a grid container with 6 child elements, how many rows will the grid have?
A4 rows, with some rows containing multiple items.
B6 rows, one for each child element.
C1 row, all items placed horizontally.
DIt will cause a layout error because 6 items don't fit in 4 rows.
Attempts:
2 left
💡 Hint
Without specifying grid-cols, the grid uses a single implicit column.
rendering
advanced
2:30remaining
What visual layout results from this Tailwind grid?
Given this HTML:
<div class="grid grid-rows-[100px_200px_1fr] gap-2">
  <div class="bg-blue-300">Row 1</div>
  <div class="bg-green-300">Row 2</div>
  <div class="bg-red-300">Row 3</div>
</div>

What will be the height of each row visually?
Tailwind
<div class="grid grid-rows-[100px_200px_1fr] gap-2">
  <div class="bg-blue-300">Row 1</div>
  <div class="bg-green-300">Row 2</div>
  <div class="bg-red-300">Row 3</div>
</div>
ARow heights are ignored and all rows collapse to zero height.
BRow 1 is 100px tall, Row 2 is 200px tall, Row 3 takes remaining space.
CRow 1 and Row 2 have auto height, Row 3 is 100px tall.
DAll rows have equal height because of the grid layout.
Attempts:
2 left
💡 Hint
Custom row sizes in Tailwind use square brackets with CSS values.
selector
advanced
1:00remaining
Which Tailwind class sets exactly 5 grid rows?
You want to create a grid with exactly 5 rows. Which Tailwind CSS class should you use?
Arows-5
Bgrid-cols-5
Cgrid-rows-5
Dgrid-row-5
Attempts:
2 left
💡 Hint
Tailwind uses the prefix grid-rows- to define number of rows.
accessibility
expert
3:00remaining
How to make a grid with rows accessible for screen readers?
You have a grid with multiple rows defined by Tailwind classes. What is the best way to ensure screen readers understand the row structure?
AUse only Tailwind classes; screen readers automatically detect grid rows.
BAdd <code>tabindex="-1"</code> to each grid item to make rows focusable.
CAdd <code>aria-rowcount</code> attribute to the grid container with the number of rows.
DUse semantic HTML elements like <code>&lt;section&gt;</code> or <code>&lt;article&gt;</code> inside each grid row and add ARIA roles if needed.
Attempts:
2 left
💡 Hint
Think about semantic HTML and ARIA roles for structure.