Display:inline for creating a horizontal navigation bar - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Nav Bar

Description

Display:inline for creating a horizontal navigation bar

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">
#navigation {<!--from  w  w  w.ja  va  2s . c  o m-->
   width:100%;
   text-align:center;
}

ul {
   list-style:none;
   margin:0px 0px;
   display:inline-block;
}

ul li {
   display:inline-block;
}

ul li a {
   color:Chartreuse;
   background:yellow;
   padding:0px 0px;
   margin:0 auto;
   font-weight:bold;
   font-size:15px;
   font-family:'sans open', Arial, Helvetica, sans-serif;
   text-decoration:none;
   display:block;
   width:auto;
   height:41px;
   line-height:16px;
   text-align:center;
   -webkit-border-radius:6px;
   -moz-border-radius:6px;
   border:2px solid blue;
}

ul li a:hover {
   color:pink;
   background:OrangeRed;
   font-weight:bold;
   text-decoration:none;
   display:block;
   width:auto;
   text-align:center;
   -webkit-border-radius:6px;
   -moz-border-radius:6px;
   border:2px solid grey;
}

ul li.sublinks a {
   color:BlueViolet;
   background:Chartreuse;
   border-bottom:2px solid yellow;
   font-weight:normal;
   text-decoration:none;
   display:block;
   width:100px;
   text-align:center;
   margin-top:3px;
}

ul li.sublinks a:hover {
   color:blue;
   background:pink;
   font-weight:normal;
   text-decoration:none;
   display:block;
   width:100px;
   text-align:center;
}

ul li.sublinks {
   display:none;
}
</style> 
 </head> 
 <body> 
  <div id="wrapper"> 
   <div id="navigation"> 
    <ul> 
     <li> <a href="#">Lore</a> </li> 
    </ul> 
    <ul> 
     <li> <a href="gallery.html" class="dropdown">Lorem i</a> </li> 
     <li class="sublinks"> <a href="#">Lorem ipsum</a> <a href="#">Lorem </a> </li> 
    </ul> 
    <ul> 
     <li> <a href="blog.html">Lore</a> </li> 
    </ul> 
    <ul> 
     <li> <a href="about.html">Lorem</a> </li> 
    </ul> 
    <ul> 
     <li> <a href="ModelReleaseForm.pdf" target="_blank">Lorem ipsum d</a> </li> 
    </ul> 
    <ul> 
     <li> <a href="contact.html">Lorem i</a> </li> 
    </ul> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials