Aligning divs by setting it to inline-block - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Div Align

Description

Aligning divs by setting it to inline-block

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">
.root>div
 {
   float:left;
   display:inline-block;
   width:34%;
}
</style> <!--from   w  w  w .jav  a  2s .  c o  m-->
 </head> 
 <body> 
  <div class="root" style="width:100%"> 
   <div>
     A 
   </div> 
   <div>
     B 
   </div> 
   <div>
     C 
   </div> 
   <div>
     D 
   </div> 
   <div>
     E 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials