Understanding CSS Variables

Asked 2 years ago, Updated 2 years ago, 106 views

Understanding CSS Variables

The gaps in the site are determined to be a few, not a separate one, so
If you want to increase the gap by using the common gap as a variable as shown below,
I think it's best practice to change everything by replacing only the following, but if you do this, it's okay to just use the bottom gap, but I think there will be a problem where margin is not applied at once. How do you deal with it?

--margin-medium --bottom:;

There is also a way to use utility, but is it better to use variables because there are too many multi-classes?

css sass

2022-09-30 21:25

1 Answers

The questions are vague, so I can't give you a granular answer, but if I were to give you a brief answer, it would be very different depending on the CSS design, including the HTML structure.

If the word utility refers to a generic class used in FLOCSS, it is based on the general premise of "change/overwrite where it doesn't fit" instead of "this alone."

Also, the argument is not to summarize it with the variable in the first place. I think it is correct to use the variable to summarize the same value.

Therefore, if you say, "There is a problem of not using margin all at once when it is on the top, bottom, left, and right," you need to think, "Isn't it wrong to use variables there?"


2022-09-30 21:25

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.