Wednesday, 2 October 2013

Navigation Menu #1 : Simple one using CSS

Leave a Comment
Hello buddies, today I've come up with a super simple navigation menubar using CSS and CSS3 transition. Focusing on the basics of navigation menu, it is made using unordered list. The list-style-type is set to none, so that all the bullets before the lists are removed. Before going through the tutorial, I hope you're familiar to CSS basics and CSS3 Transitions. If you're not then please hop over to the resource section to make those topics clear in your mind.
simple navigation bar
You should look the live demo of the Menubar before going through the tutorial.

The Basic HTML:

The basic HTML contains the ul and a class "nav" attached to it to give better functionality. As you've seem in the demo our lists get colored when the cursor is hovered. So, we apply each list a class, namely red, blue, green and purple.

<ul class="nav">

  <li class="red"><a href="#">Home</a></li>

  <li class="blue"><a href="#">About</a></li>

  <li class="green"><a href="#">Contact</a></li>

  <li class="purple"><a href="#">Creation</a></li>


Styling up the Menubar

Well, for the CSS part, the background is kept black for the class nav. Every list element is of different color as mentioned above. But, to make it bit simple and sexy, CSS3 Transitions are added to it. So, to convert unordered list into horizontal bar we need to set the all "li" means the list items to float towards left. That'll make the ul element to transform into horizontal bar. The li elements are given a padding of .3em at top- bottom and 1em for left-right. I've imported fonts using @import(to more about check resource).

@import url(;
.nav {
 width: 100%;
 margin:0 0 2em 0;
  list-style-type: none;
.nav li {
 float: left; 
  padding:.3em 1em .3em;
  border-right:1px solid #fff;  
.nav li a
  font-family: 'Lily Script One', cursive;
  -webkit-transition:background-color 1s linear;
  -webkit-transition:background-color 1s linear;
  background: #2EB8E6;
  -webkit-transition:background-color 1s linear;
  background: #66FF33;
  -webkit-transition:background-color 1s linear;

CSS is all about creativity. Be creative and just make something different of what you learnt here. Just imagine something that add in this navbar. You can edit directly into live demo, as it's coded on Codepen.

About Author:

Abhishek ('Ab') is the Owner and Editor in Chief of Technodator. He likes being creative and to think out of the box. You'll find him blogging on Tech and Programming Stuffs.


Post a Comment