Feb 23

Tagged in: Comments:Add

CSS3 Dropdown Menu

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.

View Demo CSS3 Dropdown

Preview

The image below shows how the menu will look if CSS3 is not supported.

menu preview

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.

gradient 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.

gradient image

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.

menu css

css code

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.

pure css

Delicious Stumbleupon Digg

WordPress Workshop: Zero to Hero Update: Social Media Icons

Comments

Pages: 17 16 15 14 13 12 11 10 9 8 71 » Show All

There are 167 comments (+Add)

  • 167 jackcheng

    Click the “view demo” link . After entering the demo page rightclick and page save as…

  • 166 Arturex

    [TO:Leonard on comment 165] I believe the reason it hides the sub menu on ie7 its because is showing behind the image, did you try it without that image and perhaps playing with the z-index parameters

  • 165 Leonard

    Great menu! I love it.

    One problem though: when inserting this menu into a html5 document it won’t work in IE7.

    Check it out: http://kookerij.websitenodig.nl/menu-test.htm
    Second link has a submenu, but stays hidden in IE7.

    Anyone got a solution, besides changing the doctype? :-D

  • 164 DuJing http://www.dzxr.net

    very good, very beautiful !

  • 163 Lyplba http://www.ibinggan.cn

    instensitiy or intensity ?!

  • 162 CMMaung http://www.myanmarasp.net/

    very nice post! I appreciate it!

  • 161 azman http://azman-sinoby.blogspot.com

    nice menu. i’ll try
    thank you

  • 160 ricky http://www.ricky.web.id

    adding this line to eliminate border when you click the link

    * {
    outline: none;
    -moz-outline-style:none;
    }

  • 159 Chris CC http://www.cccgraphics.com

    Where do i go to download the source code?

  • 158 Chris CC http://www.cccgraphics.com

    Awesome tutorial….but where do go to download the source code?

Pages: 17 16 15 14 13 12 11 10 9 8 71 » Show All

Post Your Comments

(required)

(required)

Comment Guidelines

  • Please keep comments related to topic. And be nice, don't spam!
  • Basic HTML tags are allowed:
    <a href> <abbr> <acronym> <blockquote> <code> <em> <strike> <strong>
  • Note: un-related or spam comments will be deleted.

Live Comment Preview

Back to top