01
Sass Basics
Variables & Nesting
Sass variables use $ prefix. Nesting mirrors HTML structure. & refers to the parent selector. Use lighten()/darken() for color manipulation.
sass
// SCSS syntax ($var)
$primary-color: #3498db;
$font-stack: -apple-system, sans-serif;
body {
font-family: $font-stack;
color: $primary-color;
a {
color: lighten($primary-color, 20%);
&:hover {
color: darken($primary-color, 10%);
}
}
}SCSS vs Indented Syntax
SCSS (.scss) is a superset of CSS — every valid CSS file is valid SCSS. Sass (.sass) removes braces and semicolons, relying on indentation. SCSS is more popular and easier to migrate. Choose one and be consistent within a project.
sass