Welcome to the Tidy Blog
A blog for developers, marketing gurus, designers and clients... Articles and news on SEO, JavaScript, CSS, XHTML, PHP, Photoshop...
Free speech bubble graphics. Free paper textures for commercial use. Free hand drawn social icon set.

FREE Horizontal CSS Navigation Bar

All navigation bars are basically lists of links, so using the <ul> and <li> elements makes tidy sense:

<ul>
<li><a href=”#”>Page1</a></li>
<li><a href=”#”>Page2</a></li>
<li><a href=”#”>Page3</a></li>
<li><a href=”#”>Page4</a></li>
</ul>

To remove the bullets you will need to add the following CSS

ul
{
list-style-type:none;
}

The navigation will then need to be floated and a tidy style applied

li
{
float:left;
}
a
{
display:block;
width:100px;
background-color:#F90;
padding:15px;
margin-left:3px;
text-decoration:none;
text-align:center;
color:#333;
}

Please note that if a DOCTYPE is not specified, floating items can produce unexpected results. So here is what your page would look like:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html>
<head>
<style type=”text/css”>
ul
{
list-style-type:none;
margin:0;
padding:0;
overflow:hidden;
}
li
{
float:left;
}
a
{
display:block;
width:100px;
background-color:#F90;
padding:15px;
margin-left:3px;
text-decoration:none;
text-align:center;
color:#333;
}
</style>
</head>
<body>
<ul>
<li><a href=”#”>Page1</a></li>
<li><a href=”#”>Page2</a></li>
<li><a href=”#”>Page3</a></li>
<li><a href=”#”>Page4</a></li>
</ul>
</body>
</html>

Download Sample

One Response to “FREE Horizontal CSS Navigation Bar”

  1. This is a useful post. I’m a student trying to learn more about the HTML industry and I really enjoyed reading it. It’s without a doubt worth sharing!

Leave a Reply

*

We like to keep busy!

We have developed and licensed out a Hotel Booking System.

We created Montgomery Moon and setup the site Business Networking Link to help support start-ups.

To find out more about our other tidy adventures and business ideas please visit MJWARD UK

About Tidy Design

Based in Southsea, Portsmouth we are a small but highly motivated team of web design and SEO dudes who love what we do!

Our aim is to provide real value and inspiration to people looking to get on the web and grow their business.

Read more.

Blog Admin

© 2013 Tidy Design
Log in

 twitter icon