Add a margin to a nested DIV - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Div

Description

Add a margin to a nested DIV

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

.inner {<!--   ww  w . j a  va 2  s. c  o m-->
   margin: 10px;
}
.outer {
   background-color: blue;
}
.outer2 {
   background-color: blue;
   display: inline-block;
}


      </style> 
 </head> 
 <body> 
  <div class="outer"> 
   <div class="inner">
     a 
   </div> 
  </div> 
  <div class="outer2"> 
   <div class="inner">
     a 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials