0

What's the point of css variables?

Apparently CSS has variables. But why? Can somebody give me an example of one being used?

22nd Jul 2018, 5:36 PM
Daniel Cooper
Daniel Cooper - avatar
5 Réponses
22nd Jul 2018, 6:00 PM
Scooby
Scooby - avatar
+ 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
22nd Jul 2018, 6:28 PM
Guillem Padilla
Guillem Padilla - avatar
+ 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
23rd Jul 2018, 8:15 AM
Calviղ
Calviղ - avatar
0
Can you guys give me an example? Like, why on earth would I use variables in css?
22nd Jul 2018, 9:50 PM
Daniel Cooper
Daniel Cooper - avatar