From the course: CSS: Variables and Fluid Layouts

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

CSS custom properties and Sass variables

CSS custom properties and Sass variables - CSS Tutorial

From the course: CSS: Variables and Fluid Layouts

Start my 1-month free trial

CSS custom properties and Sass variables

- Now that you've seen how custom properties work, in terms of their inheritance and values and so forth, let's try that same experiment again, this time using Sass variables. So this is exactly the same HTML that we had in the previous example where we have one paragraph outside the article, one paragraph inside the article. And of course our syntax is going to be different here in this CSS panel because this is actually Sass. Remember that with Sass, we simply declare a variable by putting the dollar sign in front of it and just saying color in this case that is color the variable name. And we've assigned it a value of red. So in order to declare this, if I do exactly the same thing as I did before, if I declare the text color inside of my article to be red, what would you expect to see here on the screen? Think about that just for a second. And so here I'll say the color property is the color variable and this is…

Contents