CSS style nested div with border - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Div

Description

CSS style nested div with border

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">
div {<!--   w w  w  .j  a v  a2s.  c  om-->
   display:block;
   min-height:3em;
   padding:0.3em 0;
   border:2px solid Chartreuse;
   background-color:yellow;
}

.red {
   background-color:blue;
}

.pink {
   background-color:pink;
}
</style> 
 </head> 
 <body> 
  <div class="red"> 
   <div> 
    <div> 
     <div> 
      <div> 
       <div class="pink"> 
        <div> 
         <div> 
          <div class="red"> 
           <div> 
            <div> 
             <div> 
              <div class="pink"> 
               <div> 
                <div> 
                 <div> 
                  <div> 
                   <!-- and so on --> 
                  </div> 
                 </div> 
                </div> 
               </div> 
              </div> 
             </div> 
            </div> 
           </div> 
          </div> 
         </div> 
        </div> 
       </div> 
      </div> 
     </div> 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials