Challenge - 5 Problems
Grid Gap Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate1:30remaining
What does the
gap property do in CSS Grid?In a CSS Grid layout, what is the main purpose of the
gap property?Attempts:
2 left
💡 Hint
Think about the space you see between boxes in a grid layout.
✗ Incorrect
The gap property adds space between grid items horizontally and vertically, making the layout clearer and less crowded.
📝 Syntax
intermediate1:30remaining
Which CSS code correctly sets a 20px gap between grid items?
You want to add a 20px gap between all grid items in a container. Which CSS snippet does this correctly?
CSS
.container { display: grid; grid-template-columns: repeat(3, 1fr); /* gap here */ }
Attempts:
2 left
💡 Hint
The
gap property accepts one or two values for rows and columns.✗ Incorrect
The gap property accepts one or two values. One value sets both row and column gaps equally. Multiple values like three or four are invalid.
❓ rendering
advanced2:00remaining
What visual difference does
gap: 10px 30px; create in a grid?Given a grid container with
gap: 10px 30px;, what will you see?CSS
.container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 30px; }
Attempts:
2 left
💡 Hint
Remember the order of values in
gap: first is row gap, second is column gap.✗ Incorrect
The first value in gap sets the row gap (vertical space), and the second sets the column gap (horizontal space).
❓ selector
advanced1:30remaining
Which CSS selector targets the gap between grid items?
You want to style the space between grid items using CSS. Which selector or property affects this space?
Attempts:
2 left
💡 Hint
Think about which CSS property controls spacing between grid cells.
✗ Incorrect
The gap property on the grid container controls the spacing between grid items. There is no :gap pseudo-class.
❓ accessibility
expert2:30remaining
How does using
gap improve accessibility in grid layouts?Why is it better for accessibility to use the CSS
gap property instead of adding margins to grid items?Attempts:
2 left
💡 Hint
Think about how spacing affects focus and reading order.
✗ Incorrect
Using gap keeps spacing purely visual and does not change the DOM or focus order, which helps screen readers and keyboard users navigate predictably.