This question already has an answer here:
- Is there a CSS selector by class prefix? 4 answers
Is it possible to use a "wildcard" for selectors in CSS3?
eg.
<div class="myclass-one"></div>
<div class="myclass-two></div>
<div class="myclass-three"></div>
...and then magically set all above divs to red in one go...
.myclass* { color: #f00; }
Possible?
It's not a direct answer to the question, however I would suggest in most cases to simply set multiple classes to each element:
In this way you can set rules for all
myclass
elements and then more specific rules forone
,two
andthree
.The following should do the trick:
Edit: Added wildcard (
*
) as suggested by DavidYou can easily add multiple classes to divs... So:
Then in the CSS call to the share class to apply the same styles:
And you can still use your other classes like this:
Or if you want to be more specific in the CSS like this: