Make Flexbox vertically center inline-block spans - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex Center

Description

Make Flexbox vertically center inline-block spans

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">
.views {<!--   ww w.  j  a va 2 s  .co  m-->
   display:flex;
   flex-direction:row;
   flex-wrap:wrap;
   justify-content:space-around;
}

.view {
   height:106px;
   width:106px;
}

.sprite-icon {
   position:relative;
   margin:36px auto;
   background-image:url('http://www.java2s.com/style/demo/Google-Chrome.png');
   display:block;
   height:36px;
   width:36px;
}

.sprite-icon.one {
   background-position:0 0;
}

.sprite-icon.two {
   background-position:0 36px;
}

.sprite-icon.three {
   background-position:0 71px;
}
</style> 
 </head> 
 <body> 
  <div class="views"> 
   <div class="view"> 
    <span class="sprite-icon one"></span> 
   </div> 
   <div class="view"> 
    <span class="sprite-icon two"></span> 
   </div> 
   <div class="view"> 
    <span class="sprite-icon three"></span> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials