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 overview

CSS custom properties overview - CSS Tutorial

From the course: CSS: Variables and Fluid Layouts

Start my 1-month free trial

CSS custom properties overview

- [Instructor] Recently available for our use, custom properties are an exciting new development in CSS. A custom property is similar to a variable, which you might've encountered in other programming languages or in Sass. And if you haven't programmed in other languages, well, you've likely encountered our old friend x when you did algebra back in school. X could mean anything you wanted it to mean. Substitute x in a math problem and we know how to use the value of x to get that math problem computed. Custom properties work just like these kinds of variables, but there's a few differences to be aware of. First of all, define a variable within a CSS declaration. In other words, you'll have to declare a selector with values in it in order to declare the variable rather than just saying x equals two. Next, values of variables inherit. If you place a variable value at the top level of a webpage, then all of the webpage can…

Contents