:not(.MyClass) selector with important - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:not

Description

:not(.MyClass) selector with important

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
p {<!--from   w  w w.ja v a2s  .  c  o m-->
   text-align:center;
   line-height:51px
}

div {
   background-color:Chartreuse;
   width:401px;
   height:51px;
}

.red {
   background-color:yellow;
}

.blue {
   background-color:blue;
}

.brown {
   background-color:pink;
}

div:not(.red) {
   background-color:OrangeRed;
}

.brown {
   background-color:grey;
}
</style> 
 </head> 
 <body> 
  <div class="red"> 
   <p>Lor</p> 
  </div> 
  <div class="blue"> 
   <p>Lore</p> 
  </div> 
  <div> 
   <p>Lorem ipsum dolor sit amet</p> 
  </div> 
  <div class="brown"> 
   <p>Lorem ipsum dolor sit</p> 
  </div> 
  <div class="brown"> 
   <p>Lorem ipsum dol</p> 
  </div>  
 </body>
</html>

Related Tutorials