Challenge - 5 Problems
Sass Number Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate2:00remaining
What is the output unit of this Sass calculation?
Consider the following Sass code snippet:
What is the unit of
$width: 10px;
$height: 5em;
$area: $width * $height;
What is the unit of
$area after this calculation?SASS
$width: 10px; $height: 5em; $area: $width * $height;
Attempts:
2 left
💡 Hint
Multiplying two numbers with different units combines their units in Sass.
✗ Incorrect
When you multiply two Sass numbers with different units, the resulting unit is the concatenation of both units. Here, multiplying 10px by 5em results in 50pxem.
🧠 Conceptual
intermediate2:00remaining
Which Sass unit conversion is valid?
Given the Sass variables:
Which operation will NOT cause an error in Sass?
$length1: 2in;
$length2: 5cm;
Which operation will NOT cause an error in Sass?
SASS
$length1: 2in; $length2: 5cm;
Attempts:
2 left
💡 Hint
Sass allows multiplication and division of numbers with different units but addition and subtraction require compatible units.
✗ Incorrect
In Sass, adding or subtracting numbers with incompatible units like inches and centimeters causes an error. Multiplying or dividing them is allowed and results in combined units.
❓ selector
advanced2:00remaining
Which Sass code produces a unitless number?
Which of the following Sass expressions results in a unitless number?
Attempts:
2 left
💡 Hint
Dividing two numbers with the same unit removes the units.
✗ Incorrect
Dividing 10px by 2px cancels the units, resulting in a unitless number 5. Multiplying by a unitless number keeps the unit, adding or subtracting different units causes errors or keeps units.
❓ layout
advanced2:00remaining
How does Sass handle incompatible units in addition?
What happens when you try to add these Sass variables?
$a: 10px;
$b: 2em;
$c: $a + $b;
SASS
$a: 10px; $b: 2em; $c: $a + $b;
Attempts:
2 left
💡 Hint
Sass requires units to be compatible for addition or subtraction.
✗ Incorrect
Adding numbers with different units like px and em is not allowed in Sass and causes a compilation error.
❓ accessibility
expert2:00remaining
Which Sass unit usage best supports responsive and accessible design?
You want to set font sizes that scale well on different devices and respect user preferences.
Which unit should you use in Sass for font sizes to best support accessibility?
Which unit should you use in Sass for font sizes to best support accessibility?
Attempts:
2 left
💡 Hint
Relative units adapt better to user settings and screen sizes.
✗ Incorrect
Using em units allows font sizes to scale relative to the parent element, supporting responsive layouts and user accessibility preferences better than fixed units like px or cm.