Center links in <li> menu vertically - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Menu

Description

Center links in <li> menu vertically

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">
#menu {<!--  w w  w  . j  av  a 2  s  .  c  om-->
   clear:both;
   width:671px;
   height:65px;
   background:url('https://www.java2s.com/style/demo/Google-Chrome.png') no-repeat bottom;
}

#menu ul {
   margin:0;
   padding:0;
   list-style:none;
}

#menu ul li {
   padding:0;
   margin:0;
   display:inline-block;
   vertical-align:top;
}

#menu ul li a {
   display:table-cell;
   vertical-align:middle;
   width:95px;
   height:56px;
   padding-bottom:6px;
   text-align:center;
   font-size:14px;
   text-decoration:none;
   color:Chartreuse;
   font-weight:normal;
   outline:none;
   background:url('https://www.java2s.com/style/demo/Google-Chrome.png') repeat;
   opacity:.8;
}

#menu li a:hover, #menu li .current {
   color:yellow;
   background:url('https://www.java2s.com/style/demo/Google-Chrome.png') repeat;
   opacity:2;
}
</style> 
 </head> 
 <body> 
  <div id="menu"> 
   <ul> 
    <li> <a href="./index.html" target="_parent" class="current">Lore</a> </li> 
    <li> <a href="./programm.html" target="_parent">Lorem ipsum dolor</a> </li> 
    <li> <a href="./kuenstler.html">Lorem ip</a> </li> 
    <li> <a href="./rueckblick.html">Lorem ips</a> </li> 
    <li> <a href="./team.html" target="_parent">Lore</a> </li> 
   </ul> 
  </div> 
  <!-- end of menu -->  
 </body>
</html>

Related Tutorials