The CSS variables are just like simple variable of any programming language. These variables are used to store values and have a scope in which the variables can be used. A variable is defined by using two dashes(–) at the beginning and then the name which is case-sensitive. The benefit of variables is that it allows the same values to be reused at multiple places and updated/modified from one place. Also, the variable names are easier to understand and use, compared to the values of colors.
var( --custom-name, value )
Parameters: The variable var() accepts two parameters which are listed below:
- –custom-name It is a required parameter which accepts the custom property name.
- value: It is an optional parameter. It accepts fallback value which is used when custom property is invalid.
Supported Browsers: The browser supported by CSS variables are listed below:
- Google Chrome 49.0
- Internet Explorer 15.0
- Firefox 31.0
- Safari 9.1
- opera 36.0
- Python Variables
- Perl | Variables
- Variables in TypeScript
- How to pass PHP Variables by reference ?
- How to avoid Compile Error while defining Variables
- PHP | $_FILES Array (HTTP File Upload variables)
- GRE Data Analysis | Distribution of Data, Random Variables, and Probability Distributions
- Difference between static and non-static variables in Java
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.