Select every element inside Element A that is not inside Element B, Element B is inside Element A - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:not

Description

Select every element inside Element A that is not inside Element B, Element B is inside Element A

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">
#ElementA>*,<!-- w  ww  .  j av a2s .  com-->
#ElementA>:not(.ElementB) * {
   border:2px solid Chartreuse;
   color:yellow;
}

#ElementA>.ElementB * {
   color:blue;
}
</style> 
 </head> 
 <body> 
  <div id="ElementA"> 
   <div> 
    <p>Lorem ipsum d</p> 
   </div> 
   <div class="ElementB"> 
    <div> 
     <p>Lorem ipsum d</p> 
     <h1>Lore</h1> 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials