0
What's the point of css variables?
Apparently CSS has variables. But why? Can somebody give me an example of one being used?
5 Réponses
+ 9
https://www.w3schools.com/css/css3_variables.asp
hope this will help you ☺
+ 3
Hi,
I think that creating variables make sense when doing themes.
Saving colors in variables, and using the variables for easily mantain theme colors
Hope it helps you
+ 1
CSS variable enable us to group common CSS settings in one place, its useful especially your codes has many repetitive common value settings.
It also enable your webpage page to change theme easily, for example it could used for setting different color themes, day or night theme.
Check out this code, try to change to other :root selector to see the effects. (unmask the othet :root with different css var)
https://code.sololearn.com/WP08yHQR3V0g/?ref=app
0
Can you guys give me an example? Like, why on earth would I use variables in css?