From the course: Sass Essential Training
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Using variables - Sass Tutorial
From the course: Sass Essential Training
Using variables
- [Instructor] Variables let you create placeholders for values and then use them to apply them in different places. We've already seen an example of variables in the previous code, but let's go over how they work. Sass variables begin with a dollar sign and then a variable name. They have a format that is similar to a CSS property declaration with a colon followed by an expression. That means that you can use formulas and more complex statements rather than just a simple assignment like we've seen right here. The main difference between Sass and a regular CSS variable is that the Sass variable will always be converted to CSS. And that way the CSS that's produced will be shorter than with regular CSS. Variables will normally have a global scope. So you can define them once at the top of your styles and they'll be available everywhere. You can also create variables inside curly braces and they'll become local…