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 Tutorial
From the course: CSS: Variables and Fluid Layouts
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
CSS custom properties overview3m 44s
-
(Locked)
Configure CSS custom properties2m 26s
-
(Locked)
CSS custom properties and inheritance4m 27s
-
(Locked)
CSS custom properties and Sass variables3m 37s
-
(Locked)
Using Sass variables3m 25s
-
(Locked)
Challenge: Add custom properties to type scale2m 27s
-
(Locked)
Solution: Add custom properties to type scale2m 20s
-
(Locked)
-
-
-