Reputation: 661
I have a number of CSS categories1-n and I have the following code to assign attributes to all of them:
[class*="parentcategory"] { float: left; }
Now some of them also have pseudo elements of ::before and ::after, .e.g .parentcategory1::before
and I struggle to assign attributes generally to all of these because I have the category number between "parentcategory" and e.g. "::before"
Is there a way to solve this?
Many thanks
David
Upvotes: 0
Views: 48
Reputation: 18649
Seems to work just fine like so. Any issues with this?
[class*="parentcategory"] {
color: red;
}
[class*="parentcategory"]::before {
color: black;
content: '::before';
}
<div class="parentcategory1">
parentcategory1
</div>
<div class="parentcategory2">
parentcategory2
</div>
Upvotes: 1