How to target only HTML elements that have no CSS classes
HTML elements without a class attribute or with an empty class attribute can be selected in CSS by using the negation pseudo-class and the attribute selector.
For example, to select paragraphs without classes:
p:not([class]),
p[class=""] {
color: red;
}
The first selector in the group above selects all paragraphs without a class attribute. The second selects all paragraphs with an empty class attribute. Paragraphs with one or more classes are not affected and can be styled independently.