Skip to content
FLAVIO COPES
flaviocopes.com
2026

CSS, how to select elements that do NOT have a class

By Flavio Copes

Learn how to select HTML elements that do not have a class in CSS using the :not() selector, for example p:not(.description) to style unclassed paragraphs.

~~~

To select elements in an HTML document that do NOT have a class, you can use this:

:not(.class)

For example:

p:not(.description) {
  color: red;
}
Tagged: CSS · All topics
~~~

Related posts about css: