In CSS, a comma ( , ) separates selectors. This is not a selector, so it cannot be used inside a selector. Therefore, depending on whether you want to apply the rule to
- which are not
.class1 and paragraphs that are not .class2 , - which have neither
.class1 , nor class2 , or that do not have .class1 and .class2
this is
p:not(.class1), p:not(.class2) { }
or
p:not(.class1):not(.class2) { }
or
p:not(.class1.class2) { }
BTW, IMHO it is better to avoid :not , if possible, and in this case, for example, have a general rule that applies to all p (with the properties that you want to set in the rule :not ) and one that applies to classes with a class and, if necessary, overrides the properties of the first rule.
Rotora
source share