Vertically center li's with different heights - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:UL Element

Description

Vertically center li's with different heights

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">
ul {<!--from   w  w  w.j a va 2 s. c  o  m-->
   margin:0;
   padding:0;
   list-style:none;
   width:901px;
   vertical-align:middle;
}

li {
   margin:0;
   padding:0;
   width:281px;
   display:inline-block;
   text-align:center;
   vertical-align:middle;
}

* html li {
   display:inline;
}

*:first-child + html li {
   display:inline;
}
</style> 
 </head> 
 <body> 
  <ul> 
   <li> <img src="https://www.java2s.com/style/demo/Safari.png"> </li> 
   <li> <img src="https://www.java2s.com/style/demo/Google-Chrome.png"> </li> 
   <li> <img src="https://www.java2s.com/style/demo/Firefox.png"> </li> 
   <li> <img src="https://www.java2s.com/style/demo/InternetExplorer.png"> </li> 
   <li> <img src="https://www.java2s.com/style/demo/Opera.png"> </li> 
   <li> <img src="https://www.java2s.com/style/demo/Google-Chrome.png"> </li> 
  </ul>  
 </body>
</html>

Related Tutorials