Layout div one by one with flexbox - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex

Description

Layout div one by one with flexbox

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">
html, body {
   width:100%;
}

body {<!--from   ww  w. j a  va  2s. c om-->
   margin:0;
   padding:0;
}

.flex-container {
   display:-webkit-flex;
   display:flex;
   width:401px;
   height:100%;
   background-color:Chartreuse;
}

.flex-item {
   background-color:yellow;
   width:100px;
   height:100px;
   margin:11px;
}
</style> 
 </head> 
 <body> 
  <div class="flex-container"> 
   <div class="flex-item">
     flex item 1 
   </div> 
   <div class="flex-item">
     flex item 2 
   </div> 
   <div class="flex-item">
     flex item 3 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials