CSS3 > Selectors

Not selector in CSS3

How to add style to the every element on the webpage except the specified element in CSS3?

By using not selector we can add style to the every element on the webapge except to the specified element. That means the not slelctor gives style to the every element except to the selected element.

        p {
            color: green;

        :not(p) {
            color: none;

    <b>This is b element</b>
    <p>This is p element</p>
    <p>This is P element</p>
        This is the div element.

In the above code snippet we have given colour "green"  to the <p> element and for other elements colour "none" is given. That is shown in the below output clearly.

This means that color = 'none' is getting applied to all element that is not 'p'.


 Views: 498 | Post Order: 30

Write for us