0
0
SASSmarkup~20 mins

Built-in math functions in SASS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Sass Math Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate
2:00remaining
What is the output of this Sass code using the ceil() function?
Consider the following Sass code snippet:
$value: 4.3;
$result: ceil($value);
body {
  font-size: #{$result}rem;
}
What will be the computed font-size in the rendered CSS?
SASS
$value: 4.3;
$result: ceil($value);
body {
  font-size: #{$result}rem;
}
Afont-size: 5rem;
Bfont-size: 3rem;
Cfont-size: 4rem;
Dfont-size: 4.3rem;
Attempts:
2 left
💡 Hint
The ceil() function rounds a number up to the nearest whole number.
🧠 Conceptual
intermediate
1:30remaining
Which Sass built-in math function returns the absolute value?
You want to get the positive value of a number in Sass, regardless if it is negative or positive. Which function should you use?
Afloor()
Bround()
Cabs()
Dmax()
Attempts:
2 left
💡 Hint
Think about the function that removes the sign from a number.
rendering
advanced
2:30remaining
What CSS does this Sass code produce using min() and max()?
Given this Sass code:
$width1: 100px;
$width2: 150px;
$width3: 120px;

.container {
  width: min(max($width1, $width3), $width2);
}
What is the final width value in the compiled CSS?
SASS
$width1: 100px;
$width2: 150px;
$width3: 120px;

.container {
  width: min(max($width1, $width3), $width2);
}
Awidth: 150px;
Bwidth: 100px;
Cwidth: 170px;
Dwidth: 120px;
Attempts:
2 left
💡 Hint
First find the max between $width1 and $width3, then find the min between that result and $width2.
selector
advanced
1:30remaining
Which Sass function rounds a number to the nearest integer?
You want to round a decimal number to the nearest whole number in Sass. Which function will do this?
Around()
Bfloor()
Cceil()
Dabs()
Attempts:
2 left
💡 Hint
This function rounds up or down depending on the decimal part.
accessibility
expert
3:00remaining
How can Sass math functions help improve accessibility in responsive typography?
You want to create a responsive font size that never goes below 1rem and never above 2rem, scaling smoothly between viewport widths. Which Sass math functions help enforce these limits?
AUse abs() to ensure positive sizes and ceil() to round up sizes.
BUse max() to set the minimum size and min() to set the maximum size.
CUse floor() to set minimum size and round() to set maximum size.
DUse min() to set the minimum size and max() to set the maximum size.
Attempts:
2 left
💡 Hint
Think about which function picks the bigger or smaller value.