6StringGeek
01-26-2009, 02:23 PM
Please tell me how to center the links on the menu bar...right now they are aligning left. I have some floats that may be causing it, but i can't figure it out. Sorry for any extrenuous code...I have probably made this more difficult than it really is. Thanks for any help! :o
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>NAV BAR</title>
<link href="favicon.ico" type="image/gif" rel="icon" />
<meta name="description" content="My Content" />
<meta name="keywords" content="My Keywords" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link href="nav.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="navbar">
<ul id="nav">
<li><a href="#" title="#">LINK 1</a></li>
<li><a href="#" title="#">LINK 2</a></li>
<li><a href="#" title="#">LINK 3</a></li>
<li><a href="#" title="#">LINK 4</a></li>
<li><a href="#" title="#">LINK 5</a></li>
</ul>
</div>
</body>
</html>
body {
background: #ccc;
}
#navbar {
background: #000;
width: 960px;
margin: 0 auto;
text-align: center;
padding: 0px;
border-top: 1px solid #fff;
border-bottom: 1px solid #fff;
overflow: hidden;
}
#nav {
margin: 0px;
padding: 0px;
list-style: none;
}
#nav ul {
margin: 0px;
padding: 0px;
list-style: none;
}
#nav li {
float: left;
margin: 0px auto;
padding: 0px;
}
#nav a {
background: #000;
color: #ccc;
display: block;
font-weight: 600;
margin: 0px auto;
padding: 5px 15px 5px 15px;
font-size: 14px;
font-family:'trebuchet ms', helvetica, arial, sans-serif;
text-decoration: none;
letter-spacing:1px;
}
#nav a:hover {
background: #444;
color: #fff;
margin: 0px;
padding: 5px 15px 5px 15px;
text-decoration: none;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>NAV BAR</title>
<link href="favicon.ico" type="image/gif" rel="icon" />
<meta name="description" content="My Content" />
<meta name="keywords" content="My Keywords" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link href="nav.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="navbar">
<ul id="nav">
<li><a href="#" title="#">LINK 1</a></li>
<li><a href="#" title="#">LINK 2</a></li>
<li><a href="#" title="#">LINK 3</a></li>
<li><a href="#" title="#">LINK 4</a></li>
<li><a href="#" title="#">LINK 5</a></li>
</ul>
</div>
</body>
</html>
body {
background: #ccc;
}
#navbar {
background: #000;
width: 960px;
margin: 0 auto;
text-align: center;
padding: 0px;
border-top: 1px solid #fff;
border-bottom: 1px solid #fff;
overflow: hidden;
}
#nav {
margin: 0px;
padding: 0px;
list-style: none;
}
#nav ul {
margin: 0px;
padding: 0px;
list-style: none;
}
#nav li {
float: left;
margin: 0px auto;
padding: 0px;
}
#nav a {
background: #000;
color: #ccc;
display: block;
font-weight: 600;
margin: 0px auto;
padding: 5px 15px 5px 15px;
font-size: 14px;
font-family:'trebuchet ms', helvetica, arial, sans-serif;
text-decoration: none;
letter-spacing:1px;
}
#nav a:hover {
background: #444;
color: #fff;
margin: 0px;
padding: 5px 15px 5px 15px;
text-decoration: none;
}