I want to apply a CSS rule to any element whose one of the classes matches specified prefix.

E.g. I want a rule that will apply to div that has class that starts with status- (A and C, but not B in following snippet):

<div id='A' class="foo-class status-important bar-class"></div>
<div id='B' class="foo-class bar-class"></div>
<div id='C' class="foo-class status-low-priority bar-class"></div>

Some sort of combination of:
div[class|=status] and div[class~=status-]

Is it doable under CSS 2.1? Is it doable under any CSS spec?

Note: I do know I can use jQuery to emulate that.

4 Answers
4

Leave a Reply

Your email address will not be published. Required fields are marked *