0

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

1 Answer 1

1

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>

Sign up to request clarification or add additional context in comments.

1 Comment

E P I C - that did the trick indeed! Thank you so much, that's really helpful!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.