@function double($n) { @return $n * 2; } @mixin double-mixin($n) { width: $n * 2 + px; } .box1 { width: double(10) + px; } .box2 { @include double-mixin(10); }
The function double returns a number which is then concatenated with px in the property. The mixin directly outputs the property with the calculated value. Both produce width: 20px;.
Mixins must be included using @include. Options A, B, and C use incorrect syntax for including mixins.
@function theme-color() { @return #3498db; } .button { background-color: theme-color(); color: white; }
The function theme-color() returns the hex color #3498db. This value is used in the background-color property in the output CSS.
Option D correctly uses the function main-color() to set color and the mixin spacing to set margin. Other options either misuse the mixin or hardcode values.
lightness() function to get brightness from a color.Option A correctly uses the lightness() function to get brightness and returns black or white accordingly. Option A tries to manually calculate brightness but uses incorrect logic for Sass functions. Options C and D use invalid operations on colors.