IE9和FF中下拉列表显示其后面的元素
我正在使用无序列表为页面编写下拉导航,但列表项显示其后面的元素。
通过子菜单查看 hr 是如何显示的?这就是我不想要的。
我尝试过对所有涉及的元素使用 z-index,并分配背景颜色,但这似乎不起作用。我觉得我缺少一个简单的解决方案。
相关网页
<ul id="menu" class="topNavListLeft">
<li class="headlink">@Html.ActionLink("Home", "Index", "Home")
<ul>
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
</ul>
</li>
<li class="headlink">@Html.ActionLink("About", "About", "Home")
<ul>
<li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Home", "Index", "Home")</li>
</ul>
</li>
</ul>
</div>
<div>
<br />
<hr style="position:relative; top:-25px; color:Gray; background-color:Gray; height:3px" />
</div>
编辑:这也是我的 CSS 的几个部分。
.nav a:active, .nav a:hover {
color:#1ba1e2;
}
ul.topNavListLeft {
white-space:nowrap;
padding-top:50px;
min-height:35px;
width:100%;
}
.topNavListLeft > li {
float:left;
font-size:18px;
padding-right:50px;
height:35px;
display:block;
}
.topNavListLeft div
{
float:left;
white-space:nowrap;
padding-right:60px;
}
.topNavListLeft li ul
{
display:none;
z-index:20;
}
.topNavListLeft a {
display:block;
z-index:20;
}
.topNavListLeft a:hover, .topNavListLeft li.current a {
border-bottom:solid 6px #1ba1e2;
}
.topNavListLeft li:hover ul
{
display:block;
}
ul {
list-style: none;
}
.content {
text-align:left;
width:903px;
margin:0px 40px 0px 40px;
}
.body {
margin:0px auto;
width:981px;
text-align:center;
background-color:#fff;
color: #666666;
min-height:101%;
position:relative;
font-size:14px;
font-family:'Segoe UI',arial,helvetica;
}
a {
text-decoration:none;
color:Gray;
}
a:link, a:hover {
color:#1ba1e2;
}
I'm writing a dropdown navigation for my page using an unordered list, but the list items display the elements behind them.
See how the hr displays through the submenu? That's what I don't want.
I've tried fuddling with the z-index for all the elements involved, and assigning background colors, but that doesn't seem to work. I feel like I'm missing a simple solution.
Related Html
<ul id="menu" class="topNavListLeft">
<li class="headlink">@Html.ActionLink("Home", "Index", "Home")
<ul>
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
</ul>
</li>
<li class="headlink">@Html.ActionLink("About", "About", "Home")
<ul>
<li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Home", "Index", "Home")</li>
</ul>
</li>
</ul>
</div>
<div>
<br />
<hr style="position:relative; top:-25px; color:Gray; background-color:Gray; height:3px" />
</div>
Edit: Here's a few sections of my CSS too.
.nav a:active, .nav a:hover {
color:#1ba1e2;
}
ul.topNavListLeft {
white-space:nowrap;
padding-top:50px;
min-height:35px;
width:100%;
}
.topNavListLeft > li {
float:left;
font-size:18px;
padding-right:50px;
height:35px;
display:block;
}
.topNavListLeft div
{
float:left;
white-space:nowrap;
padding-right:60px;
}
.topNavListLeft li ul
{
display:none;
z-index:20;
}
.topNavListLeft a {
display:block;
z-index:20;
}
.topNavListLeft a:hover, .topNavListLeft li.current a {
border-bottom:solid 6px #1ba1e2;
}
.topNavListLeft li:hover ul
{
display:block;
}
ul {
list-style: none;
}
.content {
text-align:left;
width:903px;
margin:0px 40px 0px 40px;
}
.body {
margin:0px auto;
width:981px;
text-align:center;
background-color:#fff;
color: #666666;
min-height:101%;
position:relative;
font-size:14px;
font-family:'Segoe UI',arial,helvetica;
}
a {
text-decoration:none;
color:Gray;
}
a:link, a:hover {
color:#1ba1e2;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想你需要的是这个:
I think what you need it this:
试试这个:寻找像 Bonobos.com 这样的菜单系统
Try this: Looking for a Menu System like Bonobos.com