我希望我的导航栏对于每个ul
元素都具有相同的宽度。我已经尝试Width:100%
过ul.navbar a
and ul.navbar li
。JSfiddle:http: //jsfiddle.net/HeyItsProdigy/a2zVr/
CSS:
@charset "utf-8";
/* Elements */
body {
margin:0;
padding:0;
background-image:url(main%20bg.jpg)
}
ul {
padding:0;
margin:0;
}
/* End of elements */
/* Id's */
#container {
margin-left:auto;
margin-right:auto;
width:1000px;
}
#body {
border:5px solid #CF0;
width:1000px;
height:1000px;
background-image:url(middle%20bg.png);
}
#navbar {
position:relative;
top:12px;
text-align:center
}
/* End of is's */
/* Classes */
.navbar {
list-style:none;
}
ul.navbar li {
display:inline;
margin:0;
padding:0px;
text-align:center;
}
ul.navbar a {
background-color:#00CCFF;
padding:10px;
margin:0px;
text-decoration:none;
color:#CF0;
border-radius:100px;
border:2px solid white;
}
ul.navbar a:hover {
background-color:#00FFFF;
padding:10px;
margin:0px;
}
/* End of classes */
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Home</title>
<script>
<!--
//-->
</script>
</head>
<body>
<div id="container">
<div id="body">
<div id="navbar">
<ul class="navbar">
<li><a href="index.html">Blog</a></li><li><a href="index.html">Photos</a></li><li><a href="index.html">Home</a></li><li><a href="index.html">Videos</a></li><li><a href="index.html">About</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>