In recent years jQuery has become the easiest and best supported way to implement simple animations online. JavaScript is exceptionally good at what it does and this article is in no way an argument against it.
However, CSS3 offers a glimpse into a possible future where basic animations are performed with straight CSS completely independent of scripting. Today we’ll take a look at how to use CSS3 to create a fun and unique navigation menu that uses @font-face, transforms and transitions.
Introduction
Your website’s navigation can communicate a lot about your business or service. Clean, usable navigation is a staple in good web design and is always your safest bet.
However, if you’re ever creating a site that doesn’t necessarily have to be so professional, the navigation provides a great place to have a little fun and insert some personality.
To get a glimpse of what we’ll be building, take a look at the live demo. I’ve added some placeholder content but the main idea here is the navigation menu.
The HTML
To start off our project, paste in the following blank HTML5 template. Notice that I’ve tossed in HTML5 Shiv to make IE and HTML5 play nice together.
Next, throw a simple unordered list into the body portion. Include some links and any text that you want for the individual menu items.
Believe it or not, that’s really all we need here. We might come back and tweak this a bit later but overall our navigation menu will remain pretty basic and easy to throw together in only a few minutes.
Basic Styles
Next create a CSS file, perform a basic reset and add some basic body settings. Since this project is so simple, we don’t need a big fancy CSS reset but it often helps to make sure all browsers are on the same page with margins and padding.
* {
padding: 0;
margin: 0;
}
body {
background: #f4f1e5;
color: #544738;
font-family: helvetica, sans-serif;
}
The next thing we want to do is take our vertical list, make it flow horizontally, and add a hover effect. Do that with the following code.
ul li {
float: left;
list-style: none;
margin-right: 1em;
}
li a {
color: #544738;
text-decoration: none;
float: left;
font-size: 25px;
padding: 12px;
}
li a:hover {
color: #7eb9be;
}
There’s nothing here you haven’t seen a thousand other places. By floating an unordered list left, we put all of the list items on the same line (remember to clear your floats if you add more content!). Other than this we’ve simply spaced the elements out and applied a hover color.
We’ll be adding fancier hover effects later but it’s important that we don’t depend entirely upon them. If we want graceful degradation across browsers then the menu should be fully functional without any CSS3. As you can see in the image below, we’ve obtained that goal and should now have a simple text-based menu that changes color on hover.

Customizing the Font
Since we’re just having fun I want to use a crazy font. My favorite option for implementing custom fonts online is pure @font-face using Paul Irish’s Bulletproof @font-face syntax .
This way we don’t have to worry about third party systems, domain, registering etc. We can simply find a font that we like and toss it straight in via CSS.
Font Squirrel
Setting up fonts with @font-face isn’t the easiest task if you’re a beginner. First you have to find a font that’s legal to use (which can be a major headache), then you have to track down multiple versions of the font and plug those versions into the Bulletproof Syntax; it’s a real pain.
Fortunately, Font Squirrel has taken just about all the work out of the process with their pre-built @font-face kits.

An @font-face kit contains everything you need: the fonts, the code, an example, etc. Simply browse the site until you find a kit that you like and click the download button. I decided to go with Kulminoituva under the “Novelty” section. It’s a crazy 3D block letter font that I would normally never use so it’s perfect for this project.

After you’ve downloaded the kit, copy the fonts to your page’s root directory and past the included text into your CSS file.
@font-face {
font-family: 'KulminoituvaRegular';
src: url('kulminoituva-webfont.eot');
src: local('‚ò∫'), url('kulminoituva-webfont.woff') format('woff'), url('kulminoituva-webfont.ttf') format('truetype'), url('kulminoituva-webfont.svg#webfontHNAi9IoX') format('svg');
font-weight: normal;
font-style: normal;
}
If you followed the bulletproof syntax link above, you should know what all this code does. If not, the only thing you really need to know is that the first line tells us how to refer to the font elsewhere in our code: ‘KulminoituvaRegular’
So now we apply a font family to the list items using the same method we normally would while using our new font as the default.
ul li {
float: left;
list-style: none;
margin-right: 1em;
font-family: 'KulminoituvaRegular', helvetica, sans-serif;
font-size: 25px;
padding: 12px;
}
li a {
color: #544738;
text-decoration: none;
float: left;
}
li a:hover {
color: #7eb9be;
}
And now our navigation menu should look a lot more fun.

We now have a pretty decent little navigation menu. Notice that we applied some backup fonts as well so that anywhere @font-face doesn’t work, Helvetica will load instead.
To finish it off, let’s throw in some CSS3 animations.
Animating the Menu
Currently the best way to do CSS animations is a two step process involving both transforms and transitions. So the first thing we want to do is decide how to manipulate the objects in our menu using a transform, then we’ll apply a transition to animate the transformation.
If you take a look at the font we’ve chosen you’ll see that the letters are all rotated back and forth to give it a sloppy hand-drawn sort of feel. We’ll use this as inspiration for our transform and introduce some more rotation when the user hovers over a link. To give even more emphasis, we’ll also introduce a scaling effect.
Transforming the Text on Hover
With CSS transforms we have four basic options: rotate, scale, skew and translate (move left and right). Since we don’t want our text to get all skewed or move around too much, we’ll stick to rotate and scale.
The syntax for implementing these is super basic and conveniently identical across the Mozilla, Webkit and Opera versions.
li a:hover {
-webkit-transform: rotate(-10deg) scale(1.2);
-moz-transform: rotate(-10deg) scale(1.2);
-o-transform: rotate(-10deg) scale(1.2);
}
As you can see, we simply applied a rotation of -10 degrees and a slight scaling of 1.2. Now when you hover over a link in the navigation, it should appear rotated and larger.

After playing with this a bit, I decided that I didn’t like the fact that all the links rotated the same way. The text feels a bit more random than that so I wanted to introduce some variation here.
The solution is to apply classes to the list items in our HTML so we can style some independently of others.
Now that we have two different classes, we can apply a separate rotation to every other link so that the first and third links will rotate counter-clockwise and the second and fourth links will rotate clockwise.
.left a:hover {
-webkit-transform: rotate(-10deg) scale(1.2);
-moz-transform: rotate(-10deg) scale(1.2);
-o-transform: rotate(-10deg) scale(1.2);
}
.right a:hover {
-webkit-transform: rotate(10deg) scale(1.2);
-moz-transform: rotate(10deg) scale(1.2);
-o-transform: rotate(10deg) scale(1.2);
}
Voila! Now we have an awesome hover rotation effect. The last thing that we want to fix is the transition. Currently, hovering over the text causes an immediate rotation. We want this to be gradual like you’d find in a cool jQuery effect.
Animating the Rotation
Our final step is to add in a CSS3 transition to animate the hover effect. As with transforms, transitions are very easy to implement and contain the same basic syntax for Webkit, Mozilla and Opera.
All you have to do is set the property that you want to animate (in this case “all”), the duration and the easing. You can choose between ease, linear, ease-in, ease-out, and ease-in-out. These effect the way the animation ramps up and slows down.
.left a:hover {
/*Transition*/
-webkit-transition:All .5s ease;
-moz-transition:All .5s ease;
-o-transition:All .5s ease;
/*Transform*/
-webkit-transform: rotate(-10deg) scale(1.2);
-moz-transform: rotate(-10deg) scale(1.2);
-o-transform: rotate(-10deg) scale(1.2);
}
.right a:hover {
/*Transition*/
-webkit-transition:All .5s ease;
-moz-transition:All .5s ease;
-o-transition:All .5s ease;
/*Transform*/
-webkit-transform: rotate(10deg) scale(1.2);
-moz-transform: rotate(10deg) scale(1.2);
-o-transform: rotate(10deg) scale(1.2);
}
As you can see, we applied the same transition to both classes. Feel free to vary this if you wish and change the transition of the first or second class.
All Finished!
That completes our navigation menu. Click here to see the live demo. Remember that you can use these animation techniques on anything you like, not just text. Try creating a thumbnail gallery or something else image-driven that uses the same effect.
Closing Thoughts
Obviously, IE users will only experience a plain menu (though it will be fully functional). You’re definitely better off with JavaScript if you want animations like this to work across all browsers. Further, the text tends to get a little choppy in Webkit during the transition. I found this to be quite annoying but couldn’t figure out a fix (let me know if you do!).
Despite any arguments against its use, CSS animations are definitely fun to play with and extremely easy to implement. Leave a comment below with a link to any cool CSS3 animations you’ve created along with a brief description of the properties you used.



Comments & Discussion
95 Comments
Pingback: CSS Brigit | Create a Fun Animated Navigation Menu With Pure CSS
Pingback: 50 Refreshing CSS Tutorials, Techniques and Resources | Prabaharan CS Blog
Pingback: 50 Refreshing CSS Tutorials, Techniques and Resources « UKWDS!
Pingback: 35+ Excellent CSS and jQuery-based Navigation Menu Tutorials and Techniques Collection | Blogger Bits
Pingback: 60 Awesome Tutorials, Tricks, and Tools that will Make You a CSS Master | Tech King
Pingback: Vectorbunker Blog » 15 CSS3 Menu Navigation Tutorials
Pingback: Create a Fun Animated Navigation Menu with Pure CSS | Design Shack | mykalology.com :: advanced
Pingback: Los mejores tutoriales y recursos para hacer tus barras de navegación | SummArg
Pingback: شرح عمل 20 قائمة باستخدام Css3 | نوافذ التقنية Windows Technology
Pingback: 15 Super Cool CSS3 Navigation Menus And Tutorials | Bloggermint
Pingback: Веселое меню навигации
Pingback: Top 100 Useful And Detailed CSS3 Tutorials And Techniques « qeqnes | Designing. jQuery, Ajax, PHP, MySQL and Templates
Pingback: 20 tutoriales: menúes CSS3 | El Blog de Sol
Pingback: 150+ CSS3 tutorials and exercises for web developers « Design and Development tuts – TutorialShock
Pingback: Beautiful CSS3 Menus tutorials | Free download softwares, music, wordpress template, joomla template, Jquery tools and tips, Beauty tips, Free online video..
Pingback: Today « yasminesoa
Pingback: An Album That Would Have Never Been « yasminesoa
Pingback: Justin Bieber vs Elvis Presley – Baby I’ll Be There. « yasminesoa
Pingback: Elvis Presley Outtakes Elvis On Tour “I John” « yasminesoa
Pingback: Metal Mulisha?s Todd Potter Ready For X (Part 1) | Singapore Education Blog Site
Pingback: Tila Tequila Gets Ready To Visit Howard Stern | Singapore Catering Directory
Pingback: Miranda Kerr out at the gym in LA | Singapore Casino Information. Integration Resorts.
Pingback: Vernon & The Autopsy Permission Form | Pets In Singapore. Find Pet Foods and Pets here!
Pingback: Once is enough | Singapore Schools Directory. Primary Schools. Secondary Schools. Poly. Junior Colleges. Universities
Pingback: 10+ Excellent CSS and jQuery-based Navigation Menu Tutorials | Psdtuts
Pingback: 20 tutoriales para crear menúes con CSS3
Pingback: Scosche BoomCan ups your mobile device’s sound for $25, annoys anyone near you | Singapore Casino Information. Integration Resorts.
Pingback: 分享50个 CSS3 最佳应用示例 | 宁静致远
Pingback: Top Hot Latest 100 Detailed CSS3 Tutorials & Techniques
Pingback: 100 Great CSS Menu Tutorials
Pingback: Sacima鲨鳍马工作室 » Blog Archive » 100 Great CSS Menu Tutorials
Pingback: 100 个强大的 CSS 制作菜单的教程 | 吉林SEO | 打造专业的吉林网站优化团队
Pingback: 50 Best CSS Menu Tutorials with Jquery effect | Desua the world of Knowledge
Pingback: Photos | A Day In The Life Of Lady Gaga | Singapore Catering Directory
Pingback: 85 Most Useful CSS3 Techniques and Tutorials for Every Web Designer and Developer | Web and Graphic Design Blog
Pingback: 100 Great CSS Menu Tutorials - pocongseXy ::Art and Dezign::
Pingback: 30 CSS Menu Tutorials to Build Attractive Menus | Flash User
Pingback: 30 آموزش ساخت منو CSS جذاب
Pingback: Best Examples of CSS3 Navigations and Menu Tutorials | Website Design Wordpress Photoshop Illustrator SEO Video Tutorials Freebies
Pingback: CSS导航栏/菜单教程 – 紫萝卜 | 所有与设计有关
Pingback: CSS导航栏/菜单教程 | logolomo
Pingback: maximun
Pingback: 23 Must-Read Tutorials for Advanced HTML5/CSS3 Coders « Designscape – advertising, branding, graphic design tutorials, news and inspiration
Pingback: 23 Must-Read Tutorials for Advanced HTML5/CSS3 Coders | Launch It Now
Pingback: 23 Must-Read Tutorials for Advanced HTML5/CSS3 Coders | Top website Designing Company in India
Pingback: 40+ Excellent CSS3 Menu Tutorials | CS5 Design
Pingback: 25 Awesome CSS3 Menu Tutorials
Pingback: 25 个非常棒的 CSS3 菜单教程 | 龟仙岛
Pingback: 25 great CSS3 menu tutorial - Open News
Pingback: گالری منوهای زیبای ایجاد شده با CSS3 | IranMaster
Pingback: 25 个非常棒的 CSS3 菜单教程 | 极地 EA163
Pingback: 25 个很棒的 CSS3 菜单教程推荐 | 松鼠博客
Pingback: Class Schedule: From Now Until the Last Day of School | IT'S ON DE ANZA
Pingback: 30 Latest CSS3 Tutorials You Probably Have Not Read Before
Pingback: Valuable CSS3 Tutorials for the Creative Designers | codeManiac - Snippets, Templates, API and the best developer content
Pingback: CSS Menu tutorials | codingquery.com
Pingback: 50 CSS3 Navigation & Menus Tutorials
Pingback: Ecommerce CSS3 website menu builder « Headstartcms
Pingback: 40+ Excellent CSS3 Menu Tutorials 2012
Pingback: 25 个非常棒的 CSS3 菜单教程 – 90互联网数据中心
Pingback: 25 Useful CSS3 Menu Tutorials
Pingback: Create a Retro CSS Animation Navigation Menu | CSS Animation Studio
Pingback: 四五外包 » 25 个很棒的 CSS3 菜单教程推荐
Pingback: Excellent CSS3 Menu Tutorials : HueDesigner
Pingback: 20 Fresh HTML5 and CSS3 Menu Tutorials
Pingback: CSS Menü Yapımı Dersleri | Enes Aktas
Pingback: 35 Top Free CSS3 Navigation Menus of 2013