I have a situation with DOM elements that possess both the foo
and bar
classes:
<div class="foo bar">...</div>
I am looking to manage the priority between them. Referring to the W3C specification on this matter, I considered that appending additional selectors to the CSS could elevate the priority. For example, if I preferred foo
to take precedence over bar
, my idea was to introduce a dummy
class like so:
.foo, .dummy{
...
}
.bar{
...
}
Will this approach be effective? Is there an alternative method to achieve this goal? I understand that using !important
can influence specific attributes, but I am seeking a more comprehensive solution for controlling the priority of the entire class specification.