Adding dropdown menu for transparent navigation bar - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Menu Dropdown

Description

Adding dropdown menu for transparent navigation bar

Demo Code

ResultView the demo in separate window

<html lang="en">
 <head> 
  <title>Navbar with Dropdown.</title> 
  <style>
body {} #nav-main {
   width:1281px;
   min-width:100%;
   position:fixed;
   top:0;
   left:0;
}

ul {<!--from   w w  w . j  ava  2 s  . co m-->
   list-style-type:none;
   margin:0;
   padding:0;
   background-color:Chartreuse;
}

li {
   display:inline-block;
}

li a, li div {
   display:block;
   color:yellow;
   text-align:center;
   padding:20px 26px;
   text-decoration:none;
}

.search-form {
   width:551px;
   box-sizing:border-box;
   padding:16px 61px;
}

input[type="search"] {
   width:100%;
   background:url('http://www.java2s.com/style/demo/Google-Chrome.png') no-repeat blue;
   border:2px solid pink;
   background-size:contain;
   padding-left:7px;
   line-height:23px;
   text-shadow:0 3px 4px WhiteSmoke;
   -webkit-box-shadow:0 2px 4px OrangeRed inset;
   -moz-box-shadow:0 2px 4px grey inset;
   box-shadow:0 2px 4px BlueViolet inset;
   -webkit-transition:all 0.8s ease 0s;
   -moz-transition:all 0.8s ease 0s;
   -o-transition:all 0.8s ease 0s;
   transition:all 0.8s ease 0s;
}

input[type="search"]:focus {
   width:301px;
}

i.material-icons {
   font-size:0px;
}

li a:hover {
   background-color:Chartreuse;
}

.dropdown {
   position:relative;
   color:yellow;
}

.dropdown ul {
   z-index:10;
   top:102%;
   position:absolute;
   display:none;
}

.dropdown:hover ul {
   display:block;
}

.dropdown ul li {
   margin:0;
   display:block;
}
</style> 
 </head> 
 <body translate="no"> 
  <ul id="nav-main"> 
   <li> <a href="#">Home</a> </li> 
   <li> <a href="/about">About</a> </li> 
   <li> <a href="/faq">FAQ</a> </li> 
   <li> <a href="/Contact">Contact</a> </li> 
   <li> 
    <form action="action_page.php" class="search-form"> 
     <input type="search" name="savanasearch" placeholder="Search..." class="nav-item5"> 
    </form> </li> 
   <li> 
    <div class="dropdown">
      Welcome 
     <ul> 
      <li> <a href="#">Login</a> </li> 
      <li> <a href="#">Register</a> </li> 
     </ul> 
    </div> </li> 
   <li> 
    <div class="dropdown">
      Some Text 
     <ul> 
      <li> <a href="#">Favorites</a> </li> 
      <li> <a href="#">Wishlist</a> </li> 
      <li> <a href="#">Track Order</a> </li> 
     </ul> 
    </div> </li> 
  </ul>  
 </body>
</html>

Related Tutorials