Color Background for offset div using Same class - HTML CSS CSS Property

HTML CSS examples for CSS Property:background-color

Description

Color Background for offset div using Same class

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">

.A<!--from  www. j a  va2s  .c  o m-->
{
   border:1px solid #000;
   width: 140px;
   height: 100px;
   padding:10px;
}
.B
{
   line-height:10px;
   width:40px;
   padding:10px;
   height:40px;
   border: inherit;
}
div.B .B .B
{
   background-color:red;
}


      </style> 
 </head> 
 <body> 
  <div class="A"> 
   <div class="B"> 
    <div class="B"> 
     <div class="B"></div> 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials