Challenge - 5 Problems
Fluid Spacing 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 code?
Given the following SASS code, what is the computed
padding value in the compiled CSS for the .container class?SASS
$base-padding: 1rem; $scale-factor: 1.5; .container { padding: calc(#{$base-padding} * #{$scale-factor}); }
Attempts:
2 left
💡 Hint
Remember that SASS variables inside calc() are inserted as raw values, not pre-calculated.
✗ Incorrect
SASS inserts variables inside calc() as raw values, so the output keeps the calc() expression with substituted values. It does not compute the multiplication beforehand.
🧠 Conceptual
intermediate1:30remaining
Why use
calc() with fluid spacing in SASS?Which of the following best explains why developers use
calc() combined with SASS variables for fluid spacing?Attempts:
2 left
💡 Hint
Think about mixing units like rem and vw for responsiveness.
✗ Incorrect
Using calc() lets you combine fixed units like rem with relative units like vw, enabling spacing that adjusts fluidly with screen size.
❓ selector
advanced2:00remaining
Which selector applies fluid spacing only on screens wider than 600px?
Given this SASS snippet, which compiled CSS selector and media query combination correctly applies fluid padding only on screens wider than 600px?
SASS
@media (min-width: 600px) { .box { padding: calc(1rem + 2vw); } }
Attempts:
2 left
💡 Hint
Check the media query condition for minimum width.
✗ Incorrect
The media query with min-width: 600px applies styles only on screens wider than 600px, so fluid padding inside it works as intended.
❓ layout
advanced1:30remaining
What visual effect does this fluid spacing produce?
Consider this CSS snippet generated from SASS:
.box {
margin: calc(1rem + 2vw);
}
What will the margin behavior be as the browser window width changes?
Attempts:
2 left
💡 Hint
Remember vw means viewport width percentage.
✗ Incorrect
2vw means 2% of viewport width, so margin grows as the window gets wider, starting from a base of 1rem.
❓ accessibility
expert2:30remaining
How to ensure fluid spacing maintains accessibility?
When using fluid spacing with calculations in SASS/CSS, which practice best supports accessibility for users with different needs?
Attempts:
2 left
💡 Hint
Think about users who zoom or change font size.
✗ Incorrect
Using relative units like rem respects user settings and zoom, improving accessibility, while fixed pixels or disabling zoom harm it.