Bird
Raised Fist0
SASSmarkup~20 mins

Importing built-in modules with @use in SASS - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Sass @use 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 @use?
Consider the following Sass code snippet:
@use "sass:color";

.button {
  color: color.scale(#6699cc, $lightness: 20%);
}

What CSS color value will be generated for the .button class?
SASS
@use "sass:color";

.button {
  color: color.scale(#6699cc, $lightness: 20%);
}
Acolor: #6699cc;
Bcolor: #336699;
Ccolor: #99bbee;
Dcolor: #99ccff;
Attempts:
2 left
💡 Hint
The color.scale function adjusts the lightness of the base color by the given percentage.
🧠 Conceptual
intermediate
1:30remaining
Which statement about @use importing built-in Sass modules is true?
Select the correct statement about using the @use rule to import built-in Sass modules like sass:math or sass:color.
ABuilt-in modules must be imported with a namespace and cannot be imported without one.
BBuilt-in modules can be imported multiple times without any namespace conflicts.
CBuilt-in modules are automatically available without any import statement.
DBuilt-in modules can only be imported using @import, not @use.
Attempts:
2 left
💡 Hint
Think about how @use handles namespaces for modules.
❓ selector
advanced
2:00remaining
Which option correctly uses a built-in Sass module function with @use?
Given the Sass code below, which option correctly uses the math.div function from the built-in sass:math module to divide 10 by 2?
SASS
@use "sass:math";

.result {
  width: ???;
}
Awidth: math(10 / 2);
Bwidth: math.div(10, 2);
Cwidth: div(10, 2);
Dwidth: math.division(10, 2);
Attempts:
2 left
💡 Hint
Remember to use the namespace and exact function name.
❓ layout
advanced
2:00remaining
What CSS does this Sass code produce when using @use with sass:list?
Analyze the following Sass code:
@use "sass:list";

.container {
  grid-template-columns: list.join(("1fr", "2fr", "1fr"), " ");
}

What is the resulting CSS for .container?
SASS
@use "sass:list";

.container {
  grid-template-columns: list.join(("1fr", "2fr", "1fr"), " ");
}
Agrid-template-columns: 1fr 2fr 1fr;
Bgrid-template-columns: ("1fr", "2fr", "1fr");
Cgrid-template-columns: 1fr, 2fr, 1fr;
Dgrid-template-columns: list.join(1fr 2fr 1fr);
Attempts:
2 left
💡 Hint
The list.join function combines list items into a string separated by the given separator.
❓ accessibility
expert
1:30remaining
What error occurs if you try to use a built-in Sass module function without @use?
Consider this Sass code:
.box {
  width: math.div(20, 4);
}

What happens if you do NOT include @use "sass:math"; at the top?
AError: Missing semicolon after math.div.
BThe code compiles and outputs width: 5;
CWarning: math.div is deprecated but still works.
DError: Undefined function "math.div".
Attempts:
2 left
💡 Hint
Think about how Sass knows where functions come from.

Practice

(1/5)
1. What does the Sass @use rule do when importing built-in modules?
easy
A. It imports CSS files directly into Sass without any namespace.
B. It imports a built-in Sass module to use its features with a namespace.
C. It compiles Sass files into CSS automatically.
D. It removes unused CSS rules from the stylesheet.

Solution

  1. Step 1: Understand the purpose of @use

    The @use rule imports Sass modules and gives access to their functions and variables under a namespace.
  2. Step 2: Differentiate from other Sass features

    Unlike @import, @use does not import raw CSS but Sass modules with scoped namespaces.
  3. Final Answer:

    It imports a built-in Sass module to use its features with a namespace. -> Option B
  4. Quick Check:

    @use imports modules with namespace [OK]
Hint: Remember: @use always adds a namespace to imported modules [OK]
Common Mistakes:
  • Confusing @use with @import for CSS files
  • Thinking @use compiles Sass to CSS
  • Assuming @use removes unused CSS
2. Which of the following is the correct syntax to import the built-in Sass math module using @use?
easy
A. @use "math";
B. @import "sass:math";
C. @use "sass:math";
D. @use math;

Solution

  1. Step 1: Recall the correct syntax for built-in modules

    Built-in Sass modules are imported with @use "sass:module-name"; syntax.
  2. Step 2: Check each option

    @use "sass:math"; uses the correct syntax with quotes and the prefix sass:. Others miss quotes, prefix, or use @import.
  3. Final Answer:

    @use "sass:math"; -> Option C
  4. Quick Check:

    Built-in modules need @use "sass:module"; [OK]
Hint: Built-in modules always use "sass:" prefix inside quotes [OK]
Common Mistakes:
  • Omitting quotes around module name
  • Using @import instead of @use
  • Forgetting the "sass:" prefix
3. Given the Sass code:
@use "sass:color";

.my-text {
  color: color.scale(color.$blue, $lightness: 20%);
}

What color effect does this code apply to .my-text?
medium
A. It causes a syntax error.
B. It makes the blue color 20% darker.
C. It changes the blue color to red.
D. It makes the blue color 20% lighter.

Solution

  1. Step 1: Understand color.scale function

    The color.scale function adjusts color properties like lightness by the given percentage.
  2. Step 2: Analyze the argument $lightness: 20%

    This increases the lightness of the blue color by 20%, making it lighter.
  3. Final Answer:

    It makes the blue color 20% lighter. -> Option D
  4. Quick Check:

    color.scale with positive lightness increases brightness [OK]
Hint: Positive $lightness in color.scale makes color lighter [OK]
Common Mistakes:
  • Confusing lightness increase with darkening
  • Assuming color changes hue instead
  • Thinking the code has syntax errors
4. What is wrong with this Sass code snippet?
@use "sass:math";

.box {
  width: math.percentage(0.5);
}
medium
A. The math.percentage() function does not exist; it should be math.percent().
B. The @use statement is missing a semicolon.
C. The function name should be math.percent() instead of math.percentage().
D. There is no error; the code is correct.

Solution

  1. Step 1: Check the function name in the math module

    The correct function to convert a decimal to a percentage is math.percent(), not math.percentage().
  2. Step 2: Verify the rest of the code

    The @use statement is correct and has a semicolon; only the function name is wrong.
  3. Final Answer:

    The math.percentage() function does not exist; it should be math.percent(). -> Option A
  4. Quick Check:

    Use math.percent() for percentage conversion [OK]
Hint: Remember: math.percent(), not math.percentage() [OK]
Common Mistakes:
  • Using incorrect function name math.percentage()
  • Thinking @use needs no semicolon
  • Assuming code is error-free
5. You want to use the Sass math module to calculate the width as 75% of 1200px. Which code correctly imports the module and calculates the width?
hard
A. @use "sass:math"; .container { width: math.div(75, 100) * 1200px; }
B. @use "sass:math"; .container { width: math.percent(0.75); }
C. @use "sass:math"; .container { width: math.div(75%, 100) * 1200px; }
D. @use "sass:math"; .container { width: math.percent(75) * 1200px; }

Solution

  1. Step 1: Import the math module correctly

    The code uses @use "sass:math"; which is correct for built-in modules.
  2. Step 2: Calculate 75% of 1200px correctly

    Using math.div(75, 100) divides 75 by 100 to get 0.75, then multiplies by 1200px for the width.
  3. Step 3: Check other options for errors

    @use "sass:math"; .container { width: math.percent(0.75); } sets width to 75% of the parent, not a fixed 900px. @use "sass:math"; .container { width: math.div(75%, 100) * 1200px; } uses math.div(75%, 100) which equals 0.75% (dividing percentage by unitless keeps %), so 0.75% * 1200px = 9px. @use "sass:math"; .container { width: math.percent(75) * 1200px; } uses math.percent(75) which returns 7500%.
  4. Final Answer:

    @use "sass:math"; .container { width: math.div(75, 100) * 1200px; } -> Option A
  5. Quick Check:

    Use math.div for division, multiply for percentage calculation [OK]
Hint: Use math.div(percentage, 100) to get decimal for calculations [OK]
Common Mistakes:
  • Using math.percent() for relative percentage instead of fixed pixel calculation
  • Dividing percentages by unitless numbers (keeping % unit)
  • Misunderstanding multiplication with units
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard