Why CSS variables used?

Why we need variables when we have Class and Id attributes.please explain

Are you referring to CSS custom properties? They allow you to define a value in one place and then reference that value in a ton of other places. This makes it easier to change the value if needed because you only need to change it in one place.

1 Like