Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html css不起作用的下拉菜单_Html_Css_Drop Down Menu_Navbar - Fatal编程技术网

Html css不起作用的下拉菜单

Html css不起作用的下拉菜单,html,css,drop-down-menu,navbar,Html,Css,Drop Down Menu,Navbar,我面临着一些问题,这个下拉菜单的东西。我读了你的文章,它帮助了我。开始时,下拉菜单起作用,但当我添加更多样式时,它就停止工作了。其他div和导航栏工作正常,但下拉菜单不工作。你能帮我指出这里应该纠正什么吗 The parent div is nav-bar-left and the style is .nav-bar-left { float; left; overflow: hidden; width: 980px; height: 26px; background-color: Lavend

我面临着一些问题,这个下拉菜单的东西。我读了你的文章,它帮助了我。开始时,下拉菜单起作用,但当我添加更多样式时,它就停止工作了。其他div和导航栏工作正常,但下拉菜单不工作。你能帮我指出这里应该纠正什么吗

The parent div is nav-bar-left and the style is
.nav-bar-left {
float; left;
overflow: hidden;
width: 980px;
height: 26px;
background-color: Lavender;
border: 1px solid MidnightBlue;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}
The navigation div is #horizontalmenu which resides within the above parent div and the style is
#horizontalmenu {
width: 733px;
margin: 0;
position: relative;
float: left;
padding: 0;
}
Rest of the styling for navigation bar is
#navbar {
list-style-type: none;
margin: 0;
width: 100%;
padding: 0;
position: relative;
display: inline-table;
height: 26px;
z-index: 5;
}
#navbar li {
float: left;
position: relative;
}
#navbar a:link, #navbar a:visited {
display: block;
color: #333;
background-color: lavender;
text-align: center;
padding: 6px 10px;
border-style: solid;
border-color: MidnightBlue;
border-width: 0 1px 0 0;
text-decoration: none;
font-size: 14px;
line-height: 14px;
}
#navbar a:hover, #navbar a:active {
color: #fff;
background-color: #6b0c36;
text-decoration: underline;
}
#navbar ul {
left:-9999px;
list-style-type: none;
margin: 0;
padding: 0;
position: absolute;
}
#navbar ul li {
float:none;
border-style: solid;
border-color: Lavender;
border-width: 0 1px 1px 1px;
}
#navbar ul a {
white-space: nowrap;
}
#navbar li:hover ul {
left: 0;
}
#navbar:hover a {
text-decoration: none;
}
#navbar li:hover ul a {
text-decoration: none;
background-color: Lavender;
color: #333;
}
#navbar li:hover ul li a:hover {
background-color: Lavender;
color: #333;
}

那么,为什么它不起作用以及可以做些什么呢?

我发现这个菜单CSS是我最好的下拉菜单收藏之一:


您可以找到这些代码的备份。

您可以创建一个文件吗?我访问了您的链接。在这里,我看到您为同一选择器添加了位置:绝对和位置:相对#nav,#nav ul{边距:0;填充:0;列表样式类型:无;列表样式位置:外部;位置:相对;线条高度:1.5em;}然后再次#nav ul{位置:绝对;宽度:12em;顶部:1.5em;显示:无;}。可以吗?