Web development , php , ajax , symfony, framework, zend
In: web resources
18 Mar 2010Earlier this week we published a post entitled 15 CSS3 Navigation and Menu Tutorials and Techniques, it is an exciting look at the possibilities and capabilities of CSS3 navigation in the near future. But, we did miss one tutorial from that list, and it is that tutorial that we publishing today.
This CSS3 tutorial was originally written in German by the Webstandard-Team, and they have kindly allowed us to translate it and publish it here. It certainly does deserve to be viewed by a wider audience.
This tutorial is about understanding, learning and mastering the some of the new features and properties of CSS3.
You will learn how to build a cool rounded navigation menu, with no images and no Javascript, and effectively make use of the new CSS3 properties border-radius and animation.
This menu works perfectly well with Chrome and Safari. With Firefox the border-radius works great but not the animation.

The basic HTML structure of the menu has three list items with the fictitious names “brand“, “promotion” and “event“.
1 2 3 4 5 6 7 |
<div class="css3Tutorial"> <ul> <li id="brand"><a href="#">Brand</a></li> <li id="promotion"><a href="#">Promotion</a></li> <li id="event"><a href="#">Event</a></li> </ul> </div> |
How the menu looks so far:

In this step we are going to give the main navigation area (.css3Tutorial) a dark background.
The width, height and padding are completely optional, they are only there for demonstartion purposes when viewing the demo.
1 2 3 4 5 6 |
.css3Tutorial { background: #14080a; width:506px; height:260px; padding:20px; } |
How the menu looks so far:

border-radiusNow we will make each .li (navigation item) rounded with some cool CSS3 magic, more specifically with the border-radius property:
So far, the navigation will work very well with Chrome, Safari and Firefox.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
ul { list-style: none; } li { float:left; font: 14px/10px Arial, Verdana, sans-serif; color:#FFF; background-color: #b6f5fe; width: 80px; height: 80px; padding:20px; margin:0 30px 0 0; -webkit-border-radius: 60px; -moz-border-radius: 60px; border-radius: 60px; } |
How the menu looks so far:

In this fourth step, we will give each .li element (navigation item) a unique background-color and position:
1 2 3 4 5 6 7 8 9 10 11 |
li#brand { background-color: #e1f5b8; } li#promotion { background-color: #b6f5fe; margin-top:100px; } li#event { background-color: #f9bde6; margin-top:50px; } |
How the menu looks so far:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
li a { color:#FFF; text-decoration:none; display:block; width: 80px; height: 45px; text-align: center; padding:35px 0 0 0; margin:0 40px 0 0; -webkit-border-radius: 40px; -moz-border-radius: 40px; border-radius: 40px; } li#brand a { background-color: #afe43f; } li#promotion a { background-color: #03aec7; } li#event a { background-color: #ba1886; } |
How the menu looks so far:

In terms of a “good user experience” we will now add the hover effect for the “inner core” of our navigation:
1 2 3 4 5 6 7 8 9 10 11 |
li a:hover, li a:focus, li a:active { width: 120px; height:65px; padding:55px 0 0 0; margin:-20px 0 0 -20px; -webkit-border-radius: 60px; -moz-border-radius: 60px; border-radius: 60px; } |
How the menu looks so far:

animation to the NavigationNow this were the navigation really comes alive. The animation property for this navigation works perfectly with Chrome anf Safari, but struggles with Firefox.
1 2 3 4 5 6 7 8 9 10 11 |
li a:hover, li a:focus, li a:active { -webkit-animation-name:bounce; -webkit-animation-duration:1s; -webkit-animation-iteration-count:4; -webkit-animation-direction:alternate; } @-webkit-keyframes bounce{from{margin:0 40px 0 0;} to{margin:120px 40px 0 0;} } |
How the final menu looks:

So, there you have it, you have now learned how to build a cool Sliding Navigation, using no Javascript, no images and only powered by some really cool CSS3 properties.
Please remember this menu is only a concept, and has not be built for usage in the wild. We are going to have to wait, Chrome and Safari aside, for all browsers to catch-up to be able use all of the cool CSS3 features. I can’t wait!

The authors of this CSS3 tutorial have been the Webstandard-Team, a group of web developers from Berlin, Germany. You can follow them on Twitter and you can visit their excellent website Webstandard-Blog, a german written Blog about Web Design, Web Standards, Accessibility & Usability.
15 CSS3 Navigation and Menu Tutorials and Techniques »
20 CSS3 Tutorials and Techniques for Creating Buttons »
24 CSS (in some cases with jQuery) Navigation and Menu Tutorials »
22 CSS Button Styling Tutorials and Techniques »
CSS References, Tutorials, Cheat Sheets, Conversion Tables and Short Codes »
50 Useful Tools and Generators for Easy CSS Development »
50 Essential Web Typography Tutorials, Tips, Guides and Best Practices »
The Blueprint CSS Framework – Tutorials, How-to Guides and Tools »
20+ Resources and Tutorials for Creative Forms using CSS »
This blog delivers stylish and dynamic news for designers and web-developers on all subjects of design, ranging from: CSS, Ajax, Javascript, web design, graphics, typography, advertising & much more. Our goal is to help you communicate effectively on the web with an engaging website or functional interface.
Copyright © 2007 - Programming Blog - is proudly powered by WordPress | Log in
Compositio Theme is created by: Design Disease brought to you by PremiumThemes.com
4 Responses to How to build a Cool Animated CSS3 Menu with no Javascript
beach_boy_nc
March 25th, 2010 at 8:41 pm
The use of CLASS is defined by the W3C to be used in multiple places in a single page. However ID is defined by the W3C to be used for a specific item on a web page.
John M
March 26th, 2010 at 9:44 pm
driver license
birth certificate
medicare card (australia)
copy of current land rates
copy of light bill
very hard in Australia to open dodgy bank account
Tommy S
April 2nd, 2010 at 4:52 pm
i would. if your cat gets a whiff of the soiled UnderPadding thru the new carpet , it will certainly make it more inclined to christen the new rug.
… just what you don't want, i'm sure.
DANNY W
June 5th, 2010 at 9:42 am
http://www.extension.iastate.edu/Publications/DR8.pdf