What are variables used for in css? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What are variables used for in css?

I’m confused

3rd Nov 2019, 4:05 AM
Adao Abdala
Adao Abdala - avatar
4 Answers
3rd Nov 2019, 4:53 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 2
Adao Abdala you are welcome. But I haven't answered yet, lol.(jk) https://code.sololearn.com/W7vwL6TUOMkt/?ref=app :root { --clr: red; } Watch this code I have made a variable named clr and I'm using this same variable in box-shadow for color. If I decide to change all colors used in box-shadow property with some other color I just need to change one line! :root{ --clr:dodgerblue; } And all colors will be changed because I changed value of variable. Variables are useful to reduce code repetition. Read the link previously posted here.
3rd Nov 2019, 5:06 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 1
thanks
3rd Nov 2019, 4:56 AM
Adao Abdala
Adao Abdala - avatar
+ 1
haha okay
3rd Nov 2019, 6:07 AM
Adao Abdala
Adao Abdala - avatar