Align 2 divs side by side in a parent - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Parent Container

Description

Align 2 divs side by side in a parent

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">
.secondGroup {<!-- ww  w  .jav  a 2  s.c o m-->
   text-align:center;
   margin-top:41px;
   margin-bottom:41px;
   overflow:auto;
   background-color:Chartreuse;
}

.col2 {
   display:inline-block;
   width:47.4%;
   height:351px;
   background:white;
}

.col2:last-child {
   margin-left:41px;
}

.col2 .title {
   float:left;
   margin-left:21px;
   font-size:15px;
}
</style> 
 </head> 
 <body> 
  <div class="secondGroup"> 
   <div class="col2"> 
    <p class="titleSection">test 1</p> 
    <hr> 
   </div> 
   <div class="col2"> 
    <p class="titleSection">test 2</p> 
    <hr> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials