Center NavBar content/links - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Nav bar alignment

Description

Center NavBar content/links

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 {<!--   ww  w.ja v a  2s  . c  om-->
   list-style-type:none;
   margin:0;
   padding:0;
   overflow:hidden;
   background-color:Chartreuse;
   text-align:center;
}

li {
   display:inline-block;
}

li a {
   display:block;
   color:yellow;
   text-align:center;
   padding:15px 17px;
   text-decoration:none;
}

a:hover:not(.active) {
   background-color:blue;
}

.active {
   background-color:pink;
}
</style> 
 </head> 
 <body> 
  <h1> <a class="headerhome" href="index.html">Lorem ips</a> </h1> 
  <ul> 
   <li> <a class="active" href="index.html">Lore</a> </li> 
   <li> <a href="about.html">Lorem</a> </li> 
   <li> <a href="contact.html">Lorem i</a> </li> 
  </ul> 
  <div class="hero"> 
   <h2>Lorem ipsum do</h2> 
   <a href="twitter.com/gavinw_">Lorem ip</a>Lor 
  </div> 
  <p id="footer">Lorem ipsum dol</p>  
 </body>
</html>

Related Tutorials