Color Values and Manipulation with Sass
📖 Scenario: You are designing a simple webpage with a colored box. You want to use Sass to manage colors easily and create a lighter shade of your main color for a hover effect.
🎯 Goal: Build a Sass stylesheet that defines a base color variable, creates a lighter version of that color, and applies these colors to a box and its hover state.
📋 What You'll Learn
Create a Sass variable named
$base-color with the exact value #3498db.Create a Sass variable named
$light-color that is a lighter version of $base-color by 30%.Write a CSS rule for a class
.color-box that sets the background color to $base-color.Add a
:hover state for .color-box that changes the background color to $light-color.💡 Why This Matters
🌍 Real World
Using variables and color functions in Sass helps keep your website colors consistent and easy to update.
💼 Career
Front-end developers often use Sass to manage styles efficiently, especially for color themes and interactive effects.
Progress0 / 4 steps