Using flex-grow to justify-content according to screen size - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex

Description

Using flex-grow to justify-content according to screen size

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">
.wrapper {<!--from w w w  .ja  v a  2 s .c  o m-->
   overflow:hidden;
}

.flex-container {
   padding:0;
   margin:0;
   list-style:none;
   -ms-box-orient:horizontal;
   display:-webkit-box;
   display:-moz-box;
   display:-ms-flexbox;
   display:-moz-flex;
   display:-webkit-flex;
   display:flex;
   margin:0 -11px;
}

.flex-item {
   background:tomato;
   padding:6px;
   width:61px;
   height:51px;
   line-height:51px;
   color:Chartreuse;
   font-weight:bold;
   font-size:3em;
   text-align:center;
   flex:2;
   margin:6px 11px;
   min-width:301px;
}

.space-between {
   -webkit-justify-content:space-between;
   justify-content:space-between;
   -webkit-flex-wrap:wrap;
   -ms-flex-wrap:wrap;
   flex-wrap:wrap;
}
</style> 
 </head> 
 <body> 
  <div class="wrapper"> 
   <ul class="flex-container space-between"> 
    <li class="flex-item">1</li> 
    <li class="flex-item">2</li> 
    <li class="flex-item">3</li> 
    <li class="flex-item">4</li> 
    <li class="flex-item">5</li> 
   </ul> 
  </div>  
 </body>
</html>

Related Tutorials