大约一年前我创建了一个网站,现在需要在主导航栏中添加一个简单的下拉菜单。我正在尝试将此 stackoverflow 解决方案合并到我的网站中:http: //jsfiddle.net/EDy7X/ - 我无法正确显示它,如果我将 css 粘贴进去,完整的菜单会出现在屏幕底部附近. 如果我像这样粘贴:#navPrices ul li {,什么都不会出现。
我有以下CSS:
/*---- NAVIGATION ----*/
#nav{
background-image:url(images/nav/nav-bar-bg.jpg);
width: 1027px;
height: 64px;
margin: 0;
padding: 0;
}
.center {
width:923px;
margin-left: auto;
margin-right:auto;
}
#nav li, #nav a {
display: block;
height: 59px;
padding-top: 3px;
overflow:hidden;
}
#nav li {
float:left;
list-style: none;
display: inline;
text-indent: -9999em;
}
#navHome { width: 106px; }
#navAbout { width: 104px; }
#navPrices { width: 181px; }
#navPrograms { width: 130px; }
#navBuy { width: 170px; }
#navLinks { width: 93px; }
#navContact { width: 139px; }
#navHome a { background: url(images/nav/btn-home.jpg) no-repeat; }
#navAbout a { background: url(images/nav/btn-about.jpg) no-repeat; }
#navPrices a { background: url(images/nav/btn-prices.jpg) no-repeat; }
#navPrograms a { background: url(images/nav/btn-programs.jpg) no-repeat; }
#navBuy a { background: url(images/nav/btn-buy.jpg) no-repeat; }
#navLinks a { background: url(images/nav/btn-links.jpg) no-repeat; }
#navContact a { background: url(images/nav/btn-contact.jpg) no-repeat; }
#navHome a:hover, #navHome a.current { background: url(images/nav/btn-home.jpg) 0 -59px no-repeat; }
#navAbout a:hover, #navAbout a.current { background: url(images/nav/btn-about.jpg) 0 -59px no-repeat; }
#navPrices a:hover, #navPrices a.current { background: url(images/nav/btn-prices.jpg) 0 -59px no-repeat; }
#navPrograms a:hover, #navPrograms a.current { background: url(images/nav/btn-programs.jpg) 0 -59px no-repeat; }
#navBuy a:hover, #navBuy a.current { background: url(images/nav/btn-buy.jpg) 0 -59px no-repeat; }
#navLinks a:hover, #navLinks a.current { background: url(images/nav/btn-links.jpg) 0 -59px no-repeat; }
#navContact a:hover, #navContact a.current { background: url(images/nav/btn-contact.jpg) 0 -59px no-repeat; }
/*---- /NAVIGATION ----*/
以及以下 HTML:
<!-- NAVIGATION -->
<div id="nav">
<div class="center">
<ul>
<li id="navHome"><a href="#">Home</a></li>
<li id="navAbout"><a href="#">About</a></li>
<li id="navPrices"><a class="current" href="#">Market Price Reports</a>
<ul>
<li><a href="#">menu item 1</a></li>
<li><a href="#">menu item 2</a></li>
</ul>
</li>
<li id="navPrograms"><a href="#">Programs</a></li>
<li id="navBuy"><a href="#">Buy/Sell/Trade</a></li>
<li id="navLinks"><a href="#">Links</a></li>
<li id="navContact"><a href="#">Contact Us</a></li>
</ul>
</div>
</div>
您可以就如何放置代码提供任何帮助,我们将不胜感激。
在此先感谢,鲍勃