Reputation: 766
I was going through a really nice tutorial
https://www.sitepoint.com/variables-in-css-custom-properties/
I was trying to understand the concept of custom properties in CSS. But I am really confused as since SASS/SCSS variable also do the same thing. Then when custom properties. Or is there any significant way one should prefer CSS custom properties over preprocessors.
Thank you !! Any help much appreciated
Upvotes: 2
Views: 507
Reputation: 191
The sass / scss is a code compiled for the css unlike the custom css which is a home-made variable to change the style of a page. But both methods contribute to the cascade. In my opinion, you have to look at browser compatibility and in which project context to use it
Upvotes: 1
Reputation: 2626
The very simple answer is that CSS properties came long after preprocessors. One of the reasons why people preferred preprocessors was the fact that it was like a programming language with functions and variables instead of just static CSS.
With the addition of properties to vanilla CSS, you can use it without the need of any preprocessor; it's just an addition to the language.
With regards to when you should use it, the question should be: when should you use CSS preprocessors. It's when you need a lot of flexibility and a programming-language like environment. I hope this answers the question.
Upvotes: 2