0

I need the rules to apply to this element:

<div class="a b"/>

And not this one:

<div class="a b c"/>
Temani Afif
  • 245,468
  • 26
  • 309
  • 415
  • 1
    I'm aware of the :not() selector, but I'm interested if there's a way to just limit rules to a set number of classes without the additional :not() clarifications. – o4zloiroman Jul 21 '20 at 06:38

1 Answers1

1

Try this one. It will apply only on where the class name matches.

div[class*="ab"]{

 /* Write your style that  you want to apply  */

}
CODAR747
  • 230
  • 1
  • 12
  • I take it won't work in the case of class="b a", but it'll do. Thanks. – o4zloiroman Jul 21 '20 at 06:48
  • You can also use title tag within div and apply the style to title. For example `
    ` write css in this format `div[title~=ab]{ /*Your style */ }` Now this will apply the style to class where the title would be ab
    – CODAR747 Jul 21 '20 at 06:52