From the course: Mastering Web Developer Interview Code

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Do you know how to use CSS variables?

Do you know how to use CSS variables?

- [Instructor] CSS is an evolving language. And to stand out during an interview, it's good to show that you're keeping up with some of the latest features. And one of the most useful features upcoming in CSS, is variables. So let's take a look at how they work and how we can use them in an existing CSS file. Now, the first thing you need to know about this feature is that support is pretty good in most browsers, except for Internet Explorer. However, you can use variables today with the PostCSS plugin, which will convert your CSS to work with older browsers. And that's something that you should already be doing for things like prefixes. Now to create variables you defined a root rule and then put your variables inside that rule. Then you can create different types of variables. Regular variables have two dashes in front of the name or you can create custom variables with the @ sign in front of the variable name. In…

Contents