Centering everything vertically, in DIV / LI - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:UL Element

Description

Centering everything vertically, in DIV / LI

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">
.menuIcons<!-- ww  w.  j a  va2  s.  c  o m-->
 {
   display:table-cell;
   background-color:Chartreuse;
   vertical-align:middle;
   height:41px;
}

.wrapper {
   display:table;
}

li,img {
   display:table-cell;
   vertical-align:middle;
}

.text {
   background-color:yellow;
   display:table-cell;
   vertical-align:middle;
}

li
 {
   background-color:blue;
   height:51px;
}

div
 {
   background-color:pink;
}
</style> 
 </head> 
 <body> 
  <ul> 
   <li> <a href="/"> </a> 
    <div class="menuIcons"> 
     <a href="/"> 
      <div class="wrapper"> 
       <img src="https://www.java2s.com/style/demo/Firefox.png" width="25" height="25" alt="home icon"> 
       <div class="text">
         Lorem 
       </div> 
      </div> </a> 
    </div> </li> 
   <li> <a href="/"> </a> 
    <div class="menuIcons"> 
     <a href="/"> 
      <div class="wrapper"> 
       <img src="https://www.java2s.com/style/demo/Safari.png" width="25" height="25" alt="home icon"> 
       <div class="text">
         Lorem 
       </div> 
      </div> </a> 
    </div> </li> 
  </ul>  
 </body>
</html>

Related Tutorials