From the course: CSS: Advanced Layouts with Grid

Unlock the full course today

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

What are CSS custom properties (variables)?

What are CSS custom properties (variables)? - CSS Tutorial

From the course: CSS: Advanced Layouts with Grid

Start my 1-month free trial

What are CSS custom properties (variables)?

- One of the really tidiest tasks anytime you're writing large style sheets is you often have properties that you want to repeat across multiple different elements. Now in some cases you can resolve this by using the cascade, but let's say you have a specific font family or a color or some of other property you want to use a specific element to make them sync up and look the same. On that case, you will then have to repeat those font families or colors or other properties across all of those different rules throughout your style sheet. And that's fine if you have a couple of them, but if you have thousands of lines of CSS or maybe you have several different style sheets it becomes really hard to manage and you often end up with a situation where you have a colored you need to swap and you forget to swap one of the colors and then something is a little bit off. So because of this these syntactic tools like SAS and LIS came about, so they introduce things like variables which allowed…

Contents