CSS3: The :not (negation) pseudo-class

What is, in its essence, the CSS3 :not pseudo-class? It's a filter that is used to separate certain elements from others depending on the presence of a certain condition. In technical terms, this pseudo-class uses a Boolean expression that negates a given condition. In human terms, it tells the browser not to consider an element with a given condition. For example:

p:not([class]) {
    color: green;

We're telling the browser to match each p element which has not a class attribute set on it. Very simple. Another example:

a:not(:link) {
  text-decoration: none;

In this case, we're matching an a element which is not a link (e.g. an anchor). As you can see, this pseudo-class negates the given condition. More information at http://www.w3.org/TR/css3-selectors/#negation.

Leave a Reply

Note: Only a member of this blog may post a comment.