CSS Solid

Pseudo-Class - :not

This is a negation pseudo-class selector. This takes simple selector as an argument and selects elements that are not represented by the argument.

Example:


<!DOCTYPE html>
<html>
<head>
    <title>CSS pseudo-class selector - :not</title>
    <style>
        p:not(#pFour) {
            color:red;
        }
    </style>
</head>
<body>
    <p>First para</p>
    <p>Second para</p>
    <p>Third para</p>
    <p id="pFour">Fourth para</p>
</body>
</html>

Result:

Above example sets text color RED to all P elements except P element with ID equal to “pFour”.