我正在制作一个网站,我希望导航栏跨越整个页面。我该怎么做?我认为方法将在ul.navbar a
元素的某个地方。
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>Simple Site</title>
</head>
<body>
<div id="container">
<div id="body">
<center>
<ul class="navbar">
<li><a href="index.html">Home</a></li>
<li><a href="about.html">About</a></li>
<li><a href="contact.html">Contact</a></li>
<li><a href="services.html">Services</a></li>
<li><a href="biography.html">Biography</a></li>
</ul>
</center>
</div>
</div>
</body>
</html>
CSS:
@charset "utf-8";
#container {
margin-left:auto;
margin-right:auto;
width:960px;
background-color:#666666;
}
#body {
background-color:#666666;
width:960px;
height:500px;
border:2px solid #FFFFFF;
margin-top:50px auto;
}
.navbar {
position:relative;
list-style:none;
border-bottom:none;
float:left;
}
ul.navbar li {
float:left;
}
ul.navbar a {
background-color:#66FF33;
margin:0px;
padding:5px;
text-decoration:none;
color:#
}
ul.navbar a:hover {
width:8em;
margin:0px;
background-color:#33FFD7;
padding:5px;
}
body {
background-color:#333333;
}