Negation :not(s1, s2)

The :not() pseudo-class first appeared in CSS3, when it only allowed a maximum of 1 simple selector as an argument. In level 4 selectors, it can take a list of selectors as an argument. The styles are applied to the elements which are not represented by the passed arguments.

In CSS3, the :not selector only allows 1 selector as an argument. In level 4 selectors, it can take a selector list as an argument.

Browser Support

Chrome Firefox Safari Opera IE Edge
Desktop no no yes no no no
Mobile no no yes no no no

Syntax

E:not(s1, s2, ...) {
/* Where s1 and s2 are two different selectors. */
}

Example

/* In this example, all p elements will be red, except for the first child and the ones with the class special. */

p:not(:first-child, .special) {
color: red;
}

Information is based on Selectors Level 4 - W3C Working Draft (last updated on May 2, 2013)
Copyright © 2013 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C liability, trademark and document use rules apply.