While I was coding the Notepad theme, I've learned some new CSS3 features and now I would like to share it with you. View the demo to see a Mac-like multi-level dropdown menu that I've created using border-radius, box-shadow, and text-shadow. It renders perfect on Firefox, Safari and Chrome. The dropdown also works on non-CSS3 compitable browsers such as IE7+, but the rounded corners and shadow will not be rendered.
Preview
The image below shows how the menu will look if CSS3 is not supported.

One Gradient Image is Used
A white-transparent image is used to achieve the gradient effect. Because the new CSS3 gradient feature is not supported by all browsers yet, it is safer to use a gradient background image.

The instensitiy of the gradient can be changed by shifting the background image up or down. Also, the gradient color can be easily adjusted by changing the background color.

CSS Code
I'm not going to explain the CSS line by line. The images below explain the key points on how this dropdown is coded.


Update Apr 13 2010: Pure CSS Dropdown (No Image Used)
The following demo used CSS gradient and IE gradient filter instead of the gradient image. It works for Webkit browsers, Firefox 3.6+, and IE.

Great works, i hope that microsoft will finally one day accept what other browser do natively
Thank’s again
Thanks for the very great tutorial. Very informative and useful.
I really like this tutorial, thank you very much..
Nice.
Quick Question (I’m a total rookie):
What’s the exact code that makes the list (er, menu) horizontal rather than vertical? Or how would one make it vertical?
Also, did you post the png graphic you used (I like the version without it though, but I wanted to check it out).
Dosn’t work under IE6….but really good.
Fantastic work!!
Great post! I’ll try it to my site.
Thanks!
great stuff is came in handy for our last client thanks a bunch
Dosn’t work in IE6
ill try it soon.. thanks
i just tested and it works! its amazing… thnx
Can you do that too on the top menu, where is index, etc, like in Mac OS X, the split buttons effect?
Thanks, still a great work!!!
This is amazing, this is beautiful.
Thanks a lot !
Great job !
Great work gracias :)
Great work, just one question :
on the demo you put the class=”current” on “home”, it works. As long as you will put the current class un the 1st lvl it’s fine to get the nice effect, but what if you put it on “N.Design Studio”, how do you get it to work so that “My project” still gets the nice grey rounded effect ? It’s someting about selecting the parent of the .current class, which is impossible in css, you can select childs with >, but a < selector does not exist.
I don’t know if I’m very clear about my thoughts don’t hesitate to ask me further questions
Nevertheless : NICE work once more !!
Dosn’t work in IE7
@ kalamaras, seriously… IE6… let it die already….
Hey! I have a question about background tag shorthand:
background: #7d7d7d url(img/gradient.png) repeat-x 0 -110px;
What does “0 -110px;” stand for? I guess it affect the transparency of the image,
but i found nothing about this shorthand structure even on w3.org!! (just none about opacity in this). Still firefox 3.6,ie 8, chrome support it (OMG).
This is cool, but i still want to know where it come from.
Heeeeeellllllllllllllpppppppppp!!!
Haz! I figure it out!
It’s just placement of png’s transparent area, none related to opacity control.
a bit dissapointed but this still a good technique. Thank alot!!
@ saiko_sama: just add .current class to both of them =]
or, if it’s conflict, just made another class for it–> got the fx.
or , might you want to use just one class for the child , then select the parent through the child —> not much reality, why would you do so? since you can do the revesed easily? that why they just have > and not <.
Hi tank you singgum3b for the answer. Actually when I posted the comment I could not add any classe, I’m working with my client’s CMS and I did not have access to the code that generated the menu so I could not modify anything.
I finaly got in touch with the admin of the CMS ( not an open source one, hélas…) who accepted to give me the piece of code so I can now modify my menu : Yeahhh ^^
Have a nice day ;)