Make hyperlinks vertical-aligned in the center inside a nav tag - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Nav bar alignment

Description

Make hyperlinks vertical-aligned in the center inside a nav tag

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">
nav {<!--   w w w  . ja  v a  2s .c  o  m-->
   display:table;
   width:100%;
   height:100px;
   background-color:Chartreuse;
   z-index:2;
}

nav a {
   width:21%;
   display:table-cell;
   background-color:yellow;
   color:blue;
   font-weight:bold;
   vertical-align:middle;
   font-size:201%;
   text-align:center;
}
</style> 
 </head> 
 <body> 
  <nav> 
   <a onclick="showArticle('...')">Lorem </a> 
   <a onclick="showArticle('...')">Lorem </a> 
   <a onclick="showArticle('...')">Lorem </a> 
   <a onclick="showArticle('...')">Lorem i</a> 
  </nav>  
 </body>
</html>

Related Tutorials