Conflicts with CSS classes
I have a CSS class given by a JS.
And then a bunch of utility classes, like (and many other examples):
Would it conflict if I keep
.show
like that?
It's quite a lazy method to just have one class given, but maybe it won't conflict, or maybe there's a better way.
Opinions, thoughts, knowledge?3 Replies
are you going to be adding html dependent on certain things? if so you could use those as additional selectors
OR
alternatively you can be more specific with your css and it's antonym
i.e.
this way you don't have side effects / accidental repaints of the DOM or accidental stacking contexts created (opacity does this)
you could also consider using CSS variables to make the .show class more of a variable holder.
i.e.
My best guess is that the latest is a better practice.
Didn't think of that, will implement it that way.
It's certainly cleaner.
Have to think about Naming conventions then for classNames that are just variable holders