0
What are variables used for in css?
I’m confused
5 ответов
+ 3
Błack Jesus❕
CSS can use variables.
https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties
+ 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.
+ 1
thanks
+ 1
haha okay