Categories Archive Search Blogroll

Sandbox

Web Development Lab - Experiments, Plugins, Workarounds

View Demo Download CSS

UPDATE

I have released a new version. You no longer have to update the width everywhere, just set the desired size by giving a value to the ul.nice-menu class. The old version is still available for download from here

This short script will show you how to create a colorful, yet simple and elegant navigation menu using nothing but CSS 3. Since the latest version of CSS and mainly it’s animation part is not supported by all ‘major’ browsers the code below will not be working in these browsers, instead it is going to nicely degrade to a similar but inanimated one.

The HTML


As you can see the HTML code is quite simple, just an ordinary list filled with anchor elements. Only the main nice-menu class is necessary, the rest is the coloring which is optional. Six colors are available by default: red, orange, green, blue, bright, dark.

Styling

CSS 3 introduced a set of new properties which makes designer’s life even more easier. With these properties you can substitute many of the plain old javascript framework solutions unless you mind those pesky IE browsers. You can read more about CSS animations at Brad Shaw’s amazing website

I’ve implemented two kind of animations: the default one with ease-in and out, and another one with bounce-in and out. To use the latter one you just have to add the bounce class to the ul:

    There is one more additional class that you can use: tight, which removes the space between list elements.

      Conclusion

      Thanks for stopping by. Please feel free to download and customize the code, also I would be grateful for leaving your feedback in the comment section below.

      Posted on 14th Jul, 2011

      CSS 3

      13 responses

      Comments
      1. nice menu :)

        Munkhtur   September 28, 2011 - 10:54 am | Reply
      2. Thanks Munkhtur! I really appreciate your feedback!

        Marcell   September 28, 2011 - 9:33 pm | Reply
      3. Thanks you so much for this menu.

        tutspress   November 16, 2011 - 4:19 am | Reply
        • Hi,
          I’m glad you like it! Feel free to use it.

          Marcell   November 16, 2011 - 9:41 am | Reply
      4. hi there i followed all tutorial step but it’s didn’t work

        Seeof   December 1, 2011 - 1:47 pm | Reply
        • Hi,
          Could you explain what part is not working? Is it the animation?

          Marcell   December 1, 2011 - 2:30 pm | Reply
      5. sorry, all work find after refreshing Ctrl + F5… thanks a lot for nice tutorial

        seeof   December 1, 2011 - 3:51 pm | Reply
        • Great! Don’t forget to change the width value of the animation as well. I’m going to update the css to use percentage soon and I’ll be releasing a new version. Keep updated.

          Marcell   December 1, 2011 - 4:29 pm | Reply
      6. Hello. Thank you for sharing. I am looking to do something similar and would like to use your code but I need the LI to have a height of 100% – so the nav element goes from the top of the browser to the bottom (it will be a “content panel” with lots of links on it). Of course height: 100%; does not work. Any ideas? Thanks again.

        Dragon   December 7, 2011 - 11:57 pm | Reply
        • I’m not sure if I understand what you are trying to achieve by setting the LI’s height to 100%. This would mean you can put only one LI inside the UL which doesn’t make sense. Can you show an example?

          Marcell   December 8, 2011 - 9:59 am | Reply
      7. Thanks for your reply. I guess I was just looking for how to set the individual nav LIs to 100% height. Maybe this wouldn’t work with your CSS since the roll-over activation is on the nav element itself and would cover the other nav elements.

        Excellent animations. Thank you for your inspiring contributions to the dev community.

        Dragon   December 8, 2011 - 1:21 pm | Reply
      Leave a Reply

      XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>