0
0
SASSmarkup~20 mins

sass:math module - 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
1:30remaining
What is the output of this Sass code using sass:math?
Consider the following Sass code snippet. What will be the value of $result after compilation?
SASS
@use 'sass:math';
$result: math.round(4.7);
A5
B4
CError: Undefined function math.round
D4.7
Attempts:
2 left
💡 Hint
The math.round() function rounds a number to the nearest whole number.
🧠 Conceptual
intermediate
1:30remaining
Which sass:math function returns the smallest integer greater than or equal to a number?
You want to get the smallest integer that is not less than a given decimal number in Sass. Which function from the sass:math module should you use?
SASS
@use 'sass:math';
Amath.abs()
Bmath.round()
Cmath.floor()
Dmath.ceil()
Attempts:
2 left
💡 Hint
Think about which function rounds numbers up.
selector
advanced
2:00remaining
What is the output of this Sass code using sass:math with nested functions?
Given the Sass code below, what is the final value of $value?
SASS
@use 'sass:math';
$value: math.abs(math.min(-3, 2, -5));
A-5
B3
C5
D-3
Attempts:
2 left
💡 Hint
First find the minimum number, then get its absolute value.
layout
advanced
2:00remaining
How does sass:math affect responsive layout calculations?
You want to calculate a width that is half of a container but rounded up to the nearest whole number using sass:math. Which code snippet correctly achieves this?
SASS
@use 'sass:math';
Awidth: math.ceil(100% / 2);
Bwidth: math.ceil(100 / 2);
Cwidth: math.ceil(50%);
Dwidth: math.ceil(50 / 100);
Attempts:
2 left
💡 Hint
Percentages need to be handled carefully in Sass math functions.
accessibility
expert
2:30remaining
Which sass:math function helps ensure consistent color contrast calculations for accessibility?
You want to calculate the luminance difference between two colors to check accessibility contrast. Which sass:math function is best suited to help with this calculation?
SASS
@use 'sass:math';
Amath.round()
Bmath.abs()
Cmath.max()
Dmath.min()
Attempts:
2 left
💡 Hint
Contrast difference should always be a positive number.