<style type="text/css">
html, body {
background: #fff;
margin: 0;
padding: 0;
}
#nav {
font-family: Verdana, sans-serif;
height: 29px;
font-size: 12px;
padding: 0 0 0 10px; /* this is used for something else */
background-color: #456;
}
#nav ul, #nav ul li {
list-style: none;
margin: 0;
padding: 9px 0 0 0px;
}
#nav ul {
text-align: center;
}
#nav ul li {
display: inline;
}
#nav ul li.last {
margin-right: 0;
}
#nav ul li a {
color: #FFF;
text-decoration: none;
padding: 0px 0 0 20px;
height: 29px;
}
#nav ul li a span {
padding: 8px 20px 0 0;
height: 21px;
}
#nav ul li a:hover {
background: #789;
}
</style>
<div id="nav">
<ul>
<li><a href="/1/"><span>One</span></a></li>
<li><a href="/2/"><span>Two</span></a></li>
<li><a href="/3/"><span>Three</span></a></li>
<li><a href="/4/"><span>Four</span></a></li>
</ul>
</div>
我对此有一个小问题,因为它不会使“悬停背景”成为导航栏高度的 100%。