Write maintainable CSS with variables, nesting, mixins, modules, maps, and compiled output.
Lessons
Return computed values with @function.
Custom Functions is easiest to learn by reading the example, changing it, and observing the result.
@use 'sass:math';
@function rem($px, $base: 16px) {
@return math.div($px, $base) * 1rem;
}
.title {
font-size: rem(24px); // 1.5rem
padding: rem(8px); // 0.5rem
}Practice the Custom Functions example in a small scratch file, then explain what changed and why.