Vertically center list ul - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:UL Element

Description

Vertically center list ul

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <style type="text/css">
.wrapper {<!--from ww  w . j  av  a 2s  . c  om-->
   width:46%;
   margin:0 auto;
}

.topnav {
   width:100%;
   height:51px;
   background:grey;
}

.topnav ul {
   list-style-type:none;
   border:2px solid Chartreuse;
   height:51px;
   margin:0;
   padding:0;
}

.topnav ul li {
   border:2px solid yellow;
   text-align:center;
   vertical-align:middle;
   display:inline-block;
   width:181px;
   height:51px;
   margin:0 auto;
}
</style> 
 </head> 
 <body> 
  <div class="topnav"> 
   <div class="wrapper"> 
    <ul> 
     <li> <a href="#">L</a> </li> 
     <li> <a href="#">L</a> </li> 
     <li> <a href="#">L</a> </li> 
    </ul> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials