css - 下拉菜单悬停问题

标签 css drop-down-menu

我快要读书了!每当您越过下拉导航菜单时,悬停图像就会下降到应有的位置下方并延伸。然后,当您尝试将鼠标指向下拉区域时,下拉区域就会消失。您可以在 http://pauldrayton.com/sites/waterdamagesegeorgia/ 上看到实际效果.我已经尝试使用 z-index 来查看是否可能是问题所在,但我还没有弄清楚!

这是 CSS。任何帮助将不胜感激。

#access {
display: block;
float: left;
margin: 0 ;
margin-right:24px;
margin-top:-30px;
border-bottom:  2px solid #CCC ;
width: 990px;
z-index: 100;
}

#access .menu-header,
div.menu {
font-size: 14px;
margin-left: 12px;
}

#access .menu-header ul,
div.menu ul {
list-style: none;
float:right;
position:relative;
margin: 0 0;
margin-right:24px;
}

#access .menu-header ul.sub-menu li { 
box-shadow: 3px 3px 3px #999; 
-moz-box-shadow: 3px 3px 3px #999; 
-webkit-box-shadow: 3px 3px 3px #999; }

#access .menu-header li,
div.menu li {
float: right;
position: relative;
padding:0px;
background:url(images/mantra_menu.png) top left no-repeat;
height: 27px;
margin-right:10px;
    z-index: 101;
}

 #access   li.current_page_item {
background:url(images/mantra_menu_current.png) top left no-repeat;
border-bottom:none;
}

 #access  li.current-menu-item {
background:url(images/mantra_menu_current.png) top left no-repeat;
border-bottom:none;
}

#access a {
color: #FFFFFF;
display: block;
height: 27px;
margin-left:10px;
padding-right: 10px;
padding-top:4px;
padding-right:25px;
text-decoration: none;
font-weight:normal !important;
background:url(images/mantra_menu.png) top right no-repeat;
position:relative;
right:-10px;
z-index: 102;
white-space:nowrap;
}

#access .menu-header li:hover,
div.menu li:hover, #access a:hover {
color:#0C85CD ;
}

#access ul ul {
display: none;
position: absolute;
top: 29px;
right: 0px important;
float: right;
z-index: 104;
background:url(images/mantra_menu_down.png)  0px 0px no-repeat;
padding:12px 0px 0px;
/*border-bottom:1px solid #CCC;*/
margin-top:-30px;

}
#access ul ul li {
display:block !important;
background:#FFF !important;
/*  border-left:1px solid #CCC;
border-right:1px solid #CCC;*/
margin-left:0 !important;
margin-right:0px !important;
/*padding-left:10px;
padding-right:10px;*/ /* disabled for submenu width fix */
padding-top:6px;
z-index: 105;
}

#access ul { }
#access ul li { }
#access ul li ul {
display: none; /* submenu width fix */ }

#access ul ul li {  /* level 2 */
border: 0;
width: 100%; /* submenu width fix */
border-left: 1px solid #EEE;
border-right: 1px solid #EEE;
border-bottom: 1px solid #EEE;
white-space: pre;

}

#access ul ul ul li { /* level 3 */
border: 0;
/* width: 100%;*/
  width: auto;
  display: block;
    float: none;
    border-top: 1px solid #EEE;
    border-right: 1px solid #EEE;
    border-bottom: 1px solid #EEE;
    white-space: pre; /* submenu width fix */
    z-index: 106;}

#access ul ul a { display: block; padding: 3px 20px 0 10px !important; 
/* submenu width fix */   }

#access ul ul a, #access ul ul ul a {
margin:0 !important;/*padding:0 !important;*/
left:0 !important;
color:#5F5B5B;
border-bottom:none;
background:none !important;
}

#access ul ul li:hover, #access ul ul ul li:hover {
background:#FCFCFC !important;
}

#access ul ul ul {
left: 100%;
top: 0;
background:url(images/mantra_menu_right.png)  0px 0px no-repeat;
padding:0px 0px 0px 12px;
    z-index: 107;
/*border:1px solid #CCC;*/
}

#access li:hover > a {
color:#0E85CD ;
}

#access ul ul :hover > a {
color:#0E85CD;
}

#access ul li:hover > ul {
display: block;
    z-index: 108;
}
#access ul li.current_page_item > a,
#access ul li.current-menu-item > a{

color: #000 !important;
background:url(images/mantra_menu_current.png) top right no-repeat;
}

#access ul ul li.current_page_item ,
#access ul ul li.current-menu-ancestor,
#access ul ul li.current-menu-item ,
#access ul ul li.current-menu-parent {
color: #000 !important;
background:#FFF !important;
}


* html #access ul li.current_page_item a,
* html #access ul li.current-menu-ancestor a,
* html #access ul li.current-menu-item a,
* html #access ul li.current-menu-parent a,
* html #access ul li a:hover {
color: #5F5B5B ;
background:url(images/mantra_menu_current.png) top right no-repeat;
}

最佳答案

我做了以下更改:

    #menu-main-navigational { 
       position:relative;
    } 
    #access .menu-header ul { 
       position:absolute; 
    }

对我有用

关于css - 下拉菜单悬停问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10590545/

相关文章:

css - 使用显示 :table with extra tags leads to cells that aren't full height

javascript - ui-select 将数组元素显示为下拉列表中的选项

javascript - 以编程方式预选择下拉菜单

java - 如何从 Selenium java 获取 Java 数组中下拉列表的选项值

javascript - 如何检查 div 是否具有具有特定值的特定 css 属性?

php - mailchimp 模板 mc :edit not showing images

html - 如何在图像上添加半透明框并右对齐?

javascript - Bootstrap 初学者 - 改变不同屏幕尺寸的 div 宽度

php - 将选定的下拉列表值存储在 PHP 中的变量中

javascript - 选择不同选项时会重置的条件下拉菜单