Forum Moderators: not2easy
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>please help me</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body{
background-color:#CCC;
margin:5px 0px 0px 20px;
padding:0px 0px 0px 0px;
}
p.nav{
font-family:arial;
font-size:14px;
font-weight:600;
word-spacing:30px;
text-align:center;
vertical-align:middle;
color:FFF;
background-color:616161;
margin:0px 0px 0px 0px;
padding:2px 0px 2px 0px;
width:740px;
}
.nospace{
word-spacing:-1px;
vertical-align:middle;
width:110px;
}
-->
</style>
</head>
<body>
<p class="nav">
link
link
link
link
<span class="nospace">multi-word link</span>
link
</p>
</body>
</html>
First of all, the HTML. A nav bar is a 'list of links' so the obvious markup to use would be an unordered list (ul).
So heres my version of the HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>please help me</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
</head>
<body>
<ul class="nav">
<li>link</li>
<li>link</li>
<li>link</li>
<li>multi-word link</li>
<li>link</li>
<li>link</li>
<li>link</li>
</ul>
</body>
</html>
Okay, thats got the markup done. Now we need to style it.
I'm going to modify your original design a little because I like to work with fluid layouts and resizable text, but you can change it back to a fixed width easily enough if you prefer.
<style type="text/css">
body{
background-color:#ccc;
margin:5px 20px;
padding:0;
}
.nav {
display: block;
color:#fff;
background-color:#616161;
font:600 85% Arial,sans-serif;
text-align:center;
padding:2px;
margin:0;
}
.nav li {
display: inline;
padding: 0 1em;
margin: 0;
}
</style>
This CSS displays the <ul> tag as the dark gray nav bar block and changes the list items to appear inline with a 1em padding between each one.
Things to Note
font instead of font-family,font-size and font-weight and specifying margin:0 instead of margin: 0px 0px 0px 0px) Enjoy.
GrahamS