On July 31, 2011 In User interface with , , , tags

Making of Google Style navigation bar

You all know that web is changing much faster than ever. So, Google also made some tweaking to their formal white and blue navigation bar to a new black and orange navigation bar. I was pretty much surprised when I saw it, then I have tried and figured it out how they made it.

See the Pen Google Style navigation bar — 2011 by Munawar Ahmed (@munwr) on CodePen.

Create unordered-list inside a div with a class ‘menu’. Inside every list element we will place on hyperlink as below.

Before the unorder-list is closed there is another div with class ‘clearFloat’ which clear’s both sides from float. So, that we can see the styling done to the class ‘menu’.

You can see on the first li item, there is a class called active. If you want highlight an element you can add class ‘active’ to li.

Here come the styling part. Lets start directly with class ‘menu’

font-family:Arial, Helvetica, sans-serif;

Here menu tells font-family, font size and total width of the navigation bar

.menu ul{

Inside class ‘menu’ ul has been set to list-style none, filled with background color #2d2d2d slightly lighter than black, margin and padding set to 0.

.menu li{

Now li inside class ‘menu’ has styled to inline-block. So, that items come in a line and li has been set to float left to remove the space between li items.

.menu li:first-child{

Do you remember first-child. It style only the first element of an item, here we used to style first list item.

.menu a{
border-top:2px solid transparent;

This is styling for hyperlink we have set it to display block, so that padding will wrap it all around. Text-decoration set to none by default its underline, text color and border set only on the top side. When it’s not hovered it will transparent.

.menu a:hover,
.menu li.active a{
border-top:2px solid #ff4800;

While the hyperlink is hovered or its active the border-top color would be #ff4800 a little bit of orange and background changes to #3d3d3d


As I said to clear the float we have used clear both side. I hope you like this tutorial and feel free to leave a comment

4 responses to “Making of Google Style navigation bar”

  1. Anonymous says:

    which could be the code to add a dropdown menu?

  2. Apophys973 says:

    This is exactly what I was looking for ! thx !

    unfortunately, active link does not highlight 🙁
    (only the link marked as “active”)