Challenge - 5 Problems
Responsive Grid Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate2:00remaining
What is the output CSS of this SASS grid code?
Given this SASS code, what CSS will it generate for the grid container?
SASS
$breakpoints: (small: 480px, medium: 768px); .container { display: grid; grid-template-columns: repeat(2, 1fr); @media (min-width: map-get($breakpoints, medium)) { grid-template-columns: repeat(4, 1fr); } }
Attempts:
2 left
💡 Hint
Look at how media queries are nested inside the SASS block and how map-get extracts breakpoint values.
✗ Incorrect
The SASS code compiles to CSS where the base grid has 2 columns. At the medium breakpoint (768px), it changes to 4 columns inside a media query. Option A matches this output exactly.
🧠 Conceptual
intermediate1:30remaining
How does the SASS map-get function help with responsive breakpoints?
Why is using
map-get($breakpoints, medium) better than hardcoding pixel values in media queries?Attempts:
2 left
💡 Hint
Think about how changing one value in a map affects all related styles.
✗ Incorrect
Using map-get with a breakpoint map means you only change the pixel value once in the map. This keeps your code DRY (Don't Repeat Yourself) and consistent.
❓ selector
advanced2:00remaining
Which SASS selector targets grid items only on medium screens?
Given a grid container with items, which SASS snippet applies styles only to
.item elements when the screen is at least 768px wide?SASS
$breakpoints: (medium: 768px); .container { display: grid; .item { color: black; // Which option applies red color only on medium screens? } }
Attempts:
2 left
💡 Hint
Remember how media queries are nested inside selectors in SASS.
✗ Incorrect
Option C correctly nests the media query inside the .item selector block using map-get, applying color red only at the medium breakpoint. Option C hardcodes the value instead of using the breakpoint map. Option C nests .item inside the media query, incorrectly targeting descendant .item elements. Option C uses wrong syntax.
❓ layout
advanced1:30remaining
What visual layout will this SASS grid produce on a 500px wide screen?
Consider this SASS code for a grid container:
$breakpoints: (small: 480px, medium: 768px);
.container {
display: grid;
grid-template-columns: repeat(1, 1fr);
gap: 1rem;
@media (min-width: map-get($breakpoints, small)) {
grid-template-columns: repeat(2, 1fr);
}
@media (min-width: map-get($breakpoints, medium)) {
grid-template-columns: repeat(4, 1fr);
}
}
What will the grid look like on a 500px wide screen?
Attempts:
2 left
💡 Hint
Check which media queries apply at 500px width.
✗ Incorrect
At 500px, the screen is wider than the small breakpoint (480px) but less than medium (768px). So the grid uses 2 columns with 1rem gap.
❓ accessibility
expert2:30remaining
How to ensure accessible keyboard navigation in a responsive grid?
You have a responsive grid of interactive cards. Which practice improves keyboard accessibility across all screen sizes?
Attempts:
2 left
💡 Hint
Think about how keyboard users interact with page elements.
✗ Incorrect
Using semantic interactive elements ensures keyboard users can tab through cards naturally. Visible focus styles help users know which card is active. Disabling tab or hiding outlines harms accessibility.