RSSAmplifier

op111.net · Oct 24, 2020

How to target HTML elements that have no CSS classes

0
Sign in to vote or save

Demetris Kikizas · op111.net

· Updated

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 selects all paragraphs without a class attribute. The second selects all paragraphs with an empty class attribute. Paragraphs with classes are not affected and can be styled independently.

Documentation

Previous How to delete (empty) the content of a file in Linux Next How to merge two Git repositories

Read the original on op111.net

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.