0
0
SASSmarkup~20 mins

Responsive grid with breakpoints in SASS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Responsive Grid Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate
2: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);
  }
}
A
.container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 768px) {
  .container {
    grid-template-columns: repeat(4, 1fr);
  }
}
B
.container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-columns: repeat(4, 1fr);
}
C
.container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
@media (min-width: 768px) {
  .container {
    grid-template-columns: repeat(2, 1fr);
  }
}
D
.container {
  display: flex;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 768px) {
  .container {
    display: grid;
    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.
🧠 Conceptual
intermediate
1: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?
AIt disables grid layouts on smaller screens.
BIt automatically converts pixel values to em units for better accessibility.
CIt prevents media queries from being applied on mobile devices.
DIt allows central management of breakpoint values, making updates easier and consistent across styles.
Attempts:
2 left
💡 Hint
Think about how changing one value in a map affects all related styles.
selector
advanced
2: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?
  }
}
A@media (min-width: 768px) { color: red; }
B@media (min-width: map-get($breakpoints, medium)) { .item { color: red; } }
C@media (min-width: map-get($breakpoints, medium)) { color: red; }
D&:media(min-width: map-get($breakpoints, medium)) { color: red; }
Attempts:
2 left
💡 Hint
Remember how media queries are nested inside selectors in SASS.
layout
advanced
1: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?
AOne column with items stacked vertically.
BTwo columns with equal width and 1rem gap between items.
CFour columns with equal width and 1rem gap.
DGrid items will overlap because no columns are defined.
Attempts:
2 left
💡 Hint
Check which media queries apply at 500px width.
accessibility
expert
2: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?
AUse semantic HTML elements like <code>&lt;button&gt;</code> or <code>&lt;a&gt;</code> for cards and ensure focus styles are visible.
BDisable tab navigation on smaller screens to avoid clutter.
CHide focus outlines with CSS to keep the design clean.
DUse only <code>&lt;div&gt;</code> elements with click handlers and no focus styles.
Attempts:
2 left
💡 Hint
Think about how keyboard users interact with page elements.