The Best CSS Dropdown Menu I’ve seen
I recall the days when complicated Javascript or Flash programming was required to produce a decent-looking dropdown menu. But these menus were often less reliable, had more errors, and were difficult to customize/use. It was time consuming and slow.
CSS Comes Along
With the advancement of the application of CSS usage, the dropdown menu market slowly evolved. The dependency on Javascript slowly reduced, and there was more emphasis on the CSS, which mean that the customization of the style/design was easier, AND it took less resources and ran faster. Also to note was that with the use of CSS, cross-browser applicability went up as well.
Today I would like to announce that, as a well-seasoned and experienced web designer/coder, that I have found the best CSS dropdown menu I could find out there which you can find here. I have applied this menu to this new website that I am working on, and it works great on IE6, IE7, and FF2. Here is why I like this CSS dropdown code :
The greatest thing about this CSS dropdown menu code is that it requires no Javascript whatsoever, and is purely XHTML and CSS!!! The most complicated aspect of this code would be the if statements that trigger codes based on browser versions (<!–[if lte IE 6]><table><tr><td><![endif]–> ), and other than that, it is relatively easy to use if you have enough knowledge of CSS and HTML.
The advantages of this code are these :
- As I mentioned – PURELY CSS/HTML. No Javascript required.
- The CSS code is already separated enough to allow you to apply designs easily.
- The CSS code is well-commented so that you do not get lost.
- The CSS code has its own protections in order to ensure it appears the same on IE5.5, IE6, IE7, and FF. There are good hacks done to the code to ensure this. Without these, the width of the <ul>, <li> and <a> elements may be off by the amount of padding depending on the browser, which can cause many problems.
- It allows up to 3 levels of menus. The top menu bar is the initial level, which will drop down vertially a set of menus, and then a 3rd set of menus to the side as a fly-out if you want. In my example I did not use it but at the origianl site, you can find the full menu at action!
- I am vouching for it. You can trust me as a skilled coder who knows what he’s talking about.
Haha, the last one sounded a bit cocky but it is quite true.
I hope this post helped many of you who were looking for a reliable code for CSS dropdown menus.




(4.67 out of 5)
wow that one is good.. im starting webdesign and i like that a lot!
cheers.
I had some problems setting the width of it on IE and FF, because they parse the with/padding relations differently, but after some tinkering around i figured it out.. you’re right, it is a lot easier than others I’ve tried!!
Thanks!
Deduct the padding from the width when it comes to IE… looks like you figured it out though. playing around with it and adjusting the pixels can help! Cheers.
I have actually looking to get a css dropdown menu for a website I was working on, and this looks good. I used to have the java dropdowns but those are horrible. Besides, the css versions also help with seo as the links are able to be indexed better than a java / flash menu.
Javascript is not accessible by a lot of search engines, and the contents may not be visible for that reason..
CSS dropdowns are great because all the elements show on search engines as generic HTML elements (under
and- tags) and it increases your search engine stats.
Also note that cosmetically this is pretty darn good, almost as good as image roll-overs.
This looks really nice, but it uses tables for the links, which I don’t think is semantically correct, from a standards point of view.
Thoughts on this?
Yes, semantically incorrect, but to get around the IE6 Issue it’s necessary in my opinion.
The greatest challenge for me to find a dropdown menu that was easy to manipulate and implement was the cross-browser issue. IE6, IE7 and FF are the three that I always try to meet (Safari, Opera are too small in portion, thus it’s toom uch time and resources for me to spend on optimizing for them as well), and as you can see in the code, the tables ONLY come up if you’re using IE6.
So far, from what I tested, the widths of the elements etc. are identialy and stable through out all 3 of the browsers I listed!
never mind that one.. what about the see through image at the top of this blog.. that rocks!