We all try to be very creative when it comes to designing a website navigation. It’s a sure thing: a good looking navigation menu can really enhance your website.
I wrote before about how to create different menus and today you’ll learn how to create another stylish CSS3 navigation menu.

The HTML
The markup could not be simpler and includes also the new HTML5 nav element.
<nav>
<ul>
<li><a href="">Home</a></li>
<li><a href="">Categories</a></li>
<li><a href="">About</a></li>
<li><a href="">Portfolio</a></li>
<li><a href="">Contact</a></li>
</ul>
</nav>
The CSS
The CSS lines below are easy to understand and I think there isn’t too much to explain:
nav {
display: block;
width: 100%;
overflow: hidden;
}
nav ul {
margin: 80px 0 20px 0;
padding: .7em;
float: left;
list-style: none;
background: #444;
background: rgba(0,0,0,.2);
-moz-border-radius: .5em;
-webkit-border-radius: .5em;
border-radius: .5em;
-moz-box-shadow: 0 1px 0 rgba(255,255,255,.2), 0 2px 1px rgba(0,0,0,.8) inset;
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,.2), 0 2px 1px rgba(0,0,0,.8) inset;
box-shadow: 0 1px 0 rgba(255,255,255,.2), 0 2px 1px rgba(0,0,0,.8) inset;
}
nav li {
float:left;
}
nav a {
float:left;
padding: .8em 1.5em;
text-decoration: none;
color: #555;
text-shadow: 0 1px 0 rgba(255,255,255,.5);
font: bold 1.1em/1 'trebuchet MS', Arial, Helvetica;
letter-spacing: 1px;
text-transform: uppercase;
border-width: 1px;
border-style: solid;
border-color: #fff #ccc #999 #eee;
background: #c1c1c1;
background: -moz-linear-gradient(#f5f5f5, #c1c1c1);
background: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#c1c1c1));
background: -webkit-linear-gradient(#f5f5f5, #c1c1c1);
background: -o-linear-gradient(#f5f5f5, #c1c1c1);
background: -ms-linear-gradient(#f5f5f5, #c1c1c1);
background: linear-gradient(#f5f5f5, #c1c1c1);
}
nav a:hover, nav a:focus {
outline: 0;
color: #fff;
text-shadow: 0 1px 0 rgba(0,0,0,.2);
background: #fac754;
background: -moz-linear-gradient(#fac754, #f8ac00);
background: -webkit-gradient(linear, left top, left bottom, from(#fac754), to(#f8ac00));
background: -webkit-linear-gradient(#fac754, #f8ac00);
background: -o-linear-gradient(#fac754, #f8ac00);
background: -ms-linear-gradient(#fac754, #f8ac00);
background: linear-gradient(#fac754, #f8ac00);
}
nav a:active {
-moz-box-shadow: 0 0 2px 2px rgba(0,0,0,.3) inset;
-webkit-box-shadow: 0 0 2px 2px rgba(0,0,0,.3) inset;
box-shadow: 0 0 2px 2px rgba(0,0,0,.3) inset;
}
nav li:first-child a {
border-left: 0;
-moz-border-radius: 4px 0 0 4px;
-webkit-border-radius: 4px 0 0 4px;
border-radius: 4px 0 0 4px;
}
nav li:last-child a {
border-right: 0;
-moz-border-radius: 0 4px 4px 0;
-webkit-border-radius: 0 4px 4px 0;
border-radius: 0 4px 4px 0;
}
The result
Gradients and inset shadows were used for the :hover and :active states.
Browser support
I like to make things work across all browsers, degrading gracefully:

IE trident preview
We’re done!
You can use this anytime as a navigation menu for your website or web application. I hope you like the final result and feel free to share your thoughts about it!

Very nice. Looks great in all browsers :-)
This is the first time I’ve seen the the html5 nav tag used in the wild…
Is there any significant benefit of using nav other than cleaner markup? :-/
Andrew, nice to hear you like it. ;)
The nav element is used to wrap main navigation links. According to HTML5 Doctor: the key phrase for this would be “major navigation”.
Cool. But probably you could style a little better the :active inner-shadow. Everything else is great.
good job , here is also a link to make css3 navigation menu http://codecanyon.net/item/menu-maker-css3-jquery/310176?ref=roodper
nice, good job.
Really You are the leader of the future thanks for the tut
super cool! great help for me.. toinksz! :)
Thank you all for you comments. It’s nice to see that your work is appreciated.
very good tutorial, so simple and easy to learn and apply,
On my iMac when I view the bottom demo in Chrome the width is not correct
Quite strange, can you send more details? Eventually a screenshot and the Chrome version you’re using?
Chrome : 16.0.912.63
http://imgur.com/Sj5to
Thanks, I will try to investigate this matter.
No problem, loving your tutorials and will share how I’m implementing them in my project soon. Thanks.
Ever find the Chrome issue?
Hi,
I don’t have the words to appreciate of Mr. Red. He done all jobs satisfactory for followers. They can fetch the ideas for developing their power of HTML5 website.
It should be multi-level…
Hey, check this article for that: CSS3 animated dropdown menu.
Love this. But, I’m have a bit of trouble in IE8, the background hover color does not show up.
Hey Lisa, thanks. Check your styles, as there should be no problem with that.
got it to work for the background hover color, now having trouble displaying the box shadow in IE. I’ve tried adding this to the style…
behavior: url(http://www2.aiag.org/ScriptContent/ie-css3.htc); /* This lets IE know to call the script on all elements which get the ‘box’ class */
I’ve also tried setting the behavior url to just/ie-css3.htc, but this doesn’t work either. I placed the ie-css3.htc file in the folder that the web page is located in.
thank…
very good
Thank you so much! This really helped me with my website!
Hi,
I’d like to know how do you decide what attributes you put under each nav category: nav, nav ul, nav li, nav a. Can you just have nav, nav li and nav li a:link (and this last little group? Rather than nav, nav ul, nav li, nav a, nav hover?
Thanks.
don’t know if you got this, so i’m sending it again.
Is there away that one could have the menu options be stacked on one another when the viewport is 340px 0r less?