Create a Sass Function with @function
📖 Scenario: You are styling a website and want to create a reusable Sass function that calculates the double of a number. This will help you keep your styles consistent and easy to update.
🎯 Goal: Build a Sass function named double that takes one number as input and returns its double. Then use this function to set the width of a container.
📋 What You'll Learn
Create a Sass function named
double using @functionThe function must take one parameter named
$numberThe function must return
$number * 2Use the
double function to set the width of a .container class to double 100px💡 Why This Matters
🌍 Real World
Sass functions help you write reusable and maintainable styles by calculating values dynamically.
💼 Career
Knowing how to write Sass functions is useful for front-end developers to create scalable CSS codebases.
Progress0 / 4 steps