0
0
SASSmarkup~20 mins

Fluid spacing with calculations in SASS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Fluid Spacing 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 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});
}
A
.container {
  padding: 1.5rem;
}
B
.container {
  padding: calc(1rem * 1.5);
}
C
.container {
  padding: 1rem 1.5rem;
}
D
.container {
  padding: calc(1.5 * 1rem);
}
Attempts:
2 left
💡 Hint
Remember that SASS variables inside calc() are inserted as raw values, not pre-calculated.
🧠 Conceptual
intermediate
1: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?
ATo prevent any changes in spacing regardless of screen size.
BTo force the browser to ignore media queries and use fixed spacing.
CTo convert all units to pixels before rendering.
DTo allow combining fixed and relative units dynamically for responsive design.
Attempts:
2 left
💡 Hint
Think about mixing units like rem and vw for responsiveness.
selector
advanced
2: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);
  }
}
A
@media (min-width: 600px) {
  .box {
    padding: calc(1rem + 2vw);
  }
}
B
@media (max-width: 600px) {
  .box {
    padding: calc(1rem + 2vw);
  }
}
C
.box {
  padding: calc(1rem + 2vw);
}
D
@media (min-width: 600px) {
  .box {
    padding: 1rem;
  }
}
Attempts:
2 left
💡 Hint
Check the media query condition for minimum width.
layout
advanced
1: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?
AMargin decreases as viewport width increases.
BMargin stays fixed at 1rem regardless of viewport size.
CMargin increases as the viewport width increases, starting from 1rem base.
DMargin randomly changes with no relation to viewport size.
Attempts:
2 left
💡 Hint
Remember vw means viewport width percentage.
accessibility
expert
2: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?
AUse relative units like rem and allow user zoom without fixed pixel values.
BUse only fixed pixel values to keep spacing consistent for all users.
CDisable user zoom to maintain layout integrity.
DUse absolute units like cm or in for precise spacing.
Attempts:
2 left
💡 Hint
Think about users who zoom or change font size.