How to select elements not of a selector with CSS?

Spread the love

Sometimes, we want to select elements not of a selector with CSS.

In this article, we’ll look at how to select elements not of a selector with CSS.

How to select elements not of a selector with CSS?

To select elements not of a selector with CSS, we use the :not pseudoselector.

For instance, we write

input:not([type="checkbox"]):not([type="submit"]) {
  //...
}

to select input elements with type attribute not checkbx and not submit.

Conclusion

To select elements not of a selector with CSS, we use the :not pseudoselector.

Leave a Reply

Your email address will not be published. Required fields are marked *