4th
August, 2010
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
FREE Horizontal CSS Navigation Bar
https://www.tidydesign.com/blog/free-horizontal-css-navigation-bar/