Aligning divs to stack them - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Div Align

Description

Aligning divs to stack them

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">
.outside {<!--  w  w  w  . jav  a 2  s. c  om-->
   position:relative;
   background-color:Chartreuse;
   height:100px;
   text-align:center;
}

.inside {
   height:31px;
   position:absolute;
   background-color:yellow;
   width:51%;
   margin:0px auto;
   bottom:0px;
   left:26%;
}

.inside_top {
   bottom:31px;
}
</style> 
 </head> 
 <body> 
  <div class="outside"> 
   <div class="inside inside_top"> 
    <p>Some content</p> 
   </div> 
   <div class="inside"> 
    <p>Some content</p> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials