Nitesh is back to blogging.. Apologies for no updates since last 2 months..
TopBottom

Multi level drop down menu for blogger

Posted by Nitesh Kothari on 12 December 2008
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

A good site navigation is very important. Every visitor or reader searches for the navigation to read more and more on the blog. I have visited many sites which do not have a site navigation at all. It becomes really difficult to search something on such blogs. I believe, one should have a multi level drop down menu, which gives better accessibility of the content to the readers. Using such menu, it becomes very easy to check almost all blog posts of a blog. Taylor Thompson, owner of Video blogging tips mailed me and asked how to design a drop down menu for the website or blog, so i decided to write a tutorial about it.


Step 1: CSS Code
Copy and paste following code just above </b:skin>

#NavbarMenu {background: #72a8d2;width: 100%;height: 25px;font-size: 12px;font-family: Arial, Tahoma, Verdana;color: #FFF;font-weight: bold;padding: 0;vertical-align:middle;margin-bottom:5px;}

#nav {margin: 0;padding: 0;vertical-align:middle;}
#nav ul {float: left;list-style: none;margin: 0;padding: 0;}
#nav li {list-style: none;margin: 0;padding: 0;}
.current_page_item {background:#dee5e5;color:#2299ff;border-bottom:1px solid #dee5e5;}

#nav li a, #nav li a:link, #nav li a:visited {color: #FFF;display: block;font-size: 15px; font-family: Georgia, Times New Roman;font-weight: normal;text-transform: none;margin: 0; padding: 3px 15px 3px;text-decoration: none; }

#nav li a:hover {background: #dee5e5;color: #2299ff;margin: 0;padding: auto 15px auto; text-decoration: none;vertical-align:middle;border-bottom:1px solid #dee5e5;}

#nav li a:active {background: #dee5e5; color: #2299ff;margin: 0;padding:auto 15px auto; text-decoration: none;border-bottom:1px solid #dee5e5;}

#nav li li a, #nav li li a:link, #nav li li a:visited {background:#555; width: 150px; color: #FFF; font-size: 14px; font-family: Georgia, Times New Roman; font-weight: normal; text-transform: none; float: none; margin: 0; padding: 7px 10px; border-bottom: 1px solid #FFF; border-left: 1px solid #FFF; border-right: 1px solid #FFF;}

#nav li li a:hover, #nav li li a:active {background: #777; color: #FFF; padding: 7px 10px; }

#nav li {float: left; padding: 0;}
#nav li ul {z-index: 9999; position: absolute; left: -999em; height: auto; width: 170px; margin: 0;padding: 0;}

#nav li ul a {width: 140px;}
#nav li ul ul { margin: -32px 0 0 171px;}
#nav li:hover ul ul, #nav li:hover ul ul ul, #nav li.sfhover ul ul, #nav li.sfhover ul ul ul {left: -999em;}
#nav li:hover ul, #nav li li:hover ul, #nav li li li:hover ul, #nav li.sfhover ul, #nav li li.sfhover ul, #nav li li li.sfhover ul {left: auto;}
#nav li:hover, #nav li.sfhover {position: static;}

Step:2 HTML Code
Copy and paste following code to body section(wherever you want to place this dropdown menu).

<div id='NavbarMenu'>
<ul id='nav'>
<li><a expr:href='data:blog.homepageUrl'>Home</a></li>
<li>
<a href='#'>Blogger Hacks</a>
<ul>
<li>
<a href='#'>Most Popular</a>
<ul>
<li><a href='#'>Sub Sub Page #1</a></li>
<li><a href='#'>Sub Sub Page #2</a></li>
<li><a href='#'>Sub Sub Page #3</a></li>
</ul>
</li>
<li><a href='#'>Most Recent</a></li>
<li><a href='#'>Most Commented</a></li>
<li><a href='#'>Top Rated</a></li>
<li><a href='#'>All Blogger Hacks</a></li>
</ul>
</li>
<li><a href='#'>Blogger Widget</a>
<ul>
<li>
<a href='#'>Most Popular</a>
<ul>
<li><a href='#'>Sub Sub Page #1</a></li>
<li><a href='#'>Sub Sub Page #2</a></li>
<li><a href='#'>Sub Sub Page #3</a></li>
</ul>
</li>
<li><a href='#'>Most Recent</a></li>
<li><a href='#'>Most Commented</a></li>
<li><a href='#'>Top Rated</a></li>
<li><a href='#'>All Blogger Hacks</a></li>
</ul>
</li>
<li><a href='#'>Blogger Templates</a></li>
<li><a href='#'>Tag Cloud</a></li>
<li><a href='javascript:togglediv("headlines")'>Headlines</a></li>
</ul>
</div>

Final Words
I am not explaining this hack in detail, because i will be writing a detailed post about multi level drop down menu which works in all the browsers. This menu does not work well with IE. submenus don't appear on mousehover. Expect a better version soon. Leave a comment here, if you have any doubts or queries.

11 comments:

Taylor said...

Thanks for the post. I am looking for menus that work in all browsers. (As you could imagine.) Lol. But I will throw up a link to your site in my blog roll.

If you'd like the link to change to a DoFollow link, let me know the anchor text you'd like me to use, and then I will fix that for you if you also add me to your blog roll and do the same for me.

Let me know.

Taylor

Taylor said...

Awesome awesome. I'll add you right now. Can you change my anchor text to just: blogging tips

that'd be great. what would you like your anchor text to be?

divxvid said...

Thank you so much for this!!!

Excellent!!!! (Works perfect with IE 7(not in ie6)and firefox.In opera appears good but grows the the width of the page!?!?
Working great...I reccoment it fot all bloggers!
Thanks again!!!
Take a look here:
http://releasethis.blogspot.com/

I had some problems (how to center the nav bar).I solve it adding more buttons to take all the width of the bar (lol)....(see ,i am an amateur about codes)

If you can tell me how to add some code for this and the other little problem (opera appearance)i'll be gratefull..

Many Thanks again......

vecini la bloc said...

Thank you for the quick answer. It worked. Have you any news about a newer or better version?

Nitesh Kothari said...

@vecini: as of now i dont haveone...because i did not get time to do it.. but soon ill do it.. you can subscribe to my feeds for next updates via email

Steve said...

Thanks for the nice information.

Could I know how to add the down arrow picture into the menu so it's look better.

You have it on top of this blog.

Boby Bratu said...

HI...i've been looking for a way to add subpages to my blog but found nothing...the next best thing is multi level dropdown menus but i dont know tha much html so that doesn't work for me. is there such a thing as a subpage for blogger? i would really apreciate a reply on my email: boby_bl_vb@yahoo.com ,thank you!

Post a Comment

Thank you for commenting at NiteshKothari.com. I follow "U comment I comment" movement. All the comment are dofollow. Please do not spam or leave meaningless or short comments. I expect you to leave me meaningful, relative and genuine comments. Thank you.