CSS :not – negation pseudo-class

Css negation pseudo-class, :not(X) can be used on any simple selector. It will match element which are not selected by selector X.

Example – css :not

Set background color of div which does not have class “box”.

<style type="text/css" media="screen">
div:not(.box) {
  background-color:lightblue;
}
</style>

<div class="box">div1</div>
<div>div2</div>
refresh

Specification

Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit

Comments

Click here to write/view comments