List-Based Menu List based drop down menu is one of the most popular site ornaments, and a lot of sites are using it as their primary navigation tool. If you want to use list based menu on your site as well, follow this tutorial I’m about to present to you and create your own with CSS/HTML in a matter of minutes.

Let us start with making the list to work with. Use the following HTML code as your guide.

  1. <div id="nav">
  2.  
  3. <ul>
  4.  
  5. <li class="first"><a href="#">Home</a></li>
  6.  
  7. <li><a href="#">Blog</a></li>
  8.  
  9. <li><a href="#">Services</a>
  10.  
  11. <ul>
  12.  
  13. <li><a href="#">SEO</a></li>
  14.  
  15. <li><a href="#">Internet Marketing</a></li>
  16.  
  17. <li><a href="#">Web Contents</a></li>
  18.  
  19. </ul>
  20.  
  21. </li>
  22.  
  23. <li><a href="#">Contact Us</a></li>
  24.  
  25. </ul>
  26.  
  27. </div>

You should notice the “nav” id that will be used in your CSS codes as identifier. Let us continue with setting up some basic CSS codes for your menu. First, set up the basics for #nav to lay down some ground formatting for your list based menu.

  1. *{ margin:0px; padding: 0px; }
  2.  
  3. #nav {
  4.  
  5. font-family: arial, sans-serif;
  6.  
  7. position: relative;
  8.  
  9. width: 390px;
  10.  
  11. height:56px;
  12.  
  13. font-size:14px;
  14.  
  15. color:#999;
  16.  
  17. margin: 0 auto;
  18.  
  19. }
  20.  
  21. #nav ul {
  22.  
  23. list-style-type: none;
  24.  
  25. }

Add the following piece of CSS code to make your list based menu float. This will make integrating the menu to your site a lot easier.

  1. #nav ul li {
  2.  
  3. float: left
  4.  
  5. position: relative;
  6.  
  7. }

Add the following code to your CSS to make the list clickable as a whole — instead of just the text — and add separating borders to the design. Of course, you can change colors and border settings used.

  1. #nav ul li a {
  2.  
  3. text-align: center;
  4.  
  5. border-right:1px solid #e9e9e9;
  6.  
  7. padding:20px;
  8.  
  9. display:block;
  10.  
  11. text-decoration:none;
  12.  
  13. color:#999;
  14.  
  15. }

The following CSS codes will allow you to format child nodes properly and create a smooth dropdown effect.

  1. #nav ul li ul {
  2.  
  3. display: none
  4.  
  5. }
  6.  
  7. #nav ul li:hover ul {
  8.  
  9. display: block;
  10.  
  11. position: absolute;
  12.  
  13. }

Last but not least, add the following code to your CSS to set the hover state of the nodes.

  1. #nav ul li:hover ul li a {
  2.  
  3. display:block;
  4.  
  5. background:#12aeef;
  6.  
  7. color:#ffffff;
  8.  
  9. width: 110px;
  10.  
  11. text-align: center;
  12.  
  13. border-bottom: 1px solid #f2f2f2;
  14.  
  15. border-right: none;
  16.  
  17. }
  18.  
  19. #nav ul li:hover ul li a:hover {
  20.  
  21. background:#6dc7ec;
  22.  
  23. color:#fff;
  24.  
  25. }

When it comes to integrating the menu to your site, all you have to do is insert the CSS codes into your CSS file and add the HTML list code wherever on the page within a container. The new list based dropdown menu will be a nice addition to your already intuitive design.

Free eBook: Important WordPress Plugins

Free eBook: Important WordPress Plugins

An exhaustive list of all free, premium WordPress plugins we use across network of our wordpress sites.

Download now!

Please check your email and confirm your email address now!

Pin It on Pinterest

Review Of Web
List-Based Menu
Free eBook: Important WordPress Plugins
undefined
Review by ReviewOfWeb
Monitored by Sucuri
Share This