0

这是网站:http ://www.mccaonline.com

我被聘用处理网站上的渐变菜单问题。菜单在 Firefox、Chrome 和 Safari 中正常运行 - 当您将鼠标悬停在菜单元素上时,背景变为浅渐变绿色。然而,在 IE8 和 IE9 中,所有子菜单元素都分配有浅绿色渐变背景。

这是它在 IE8 中的外观

我只是希望它在 Internet Explorer 中具有相同的功能,并且无法弄清楚是什么导致它在所有子菜单元素上都具有渐变背景。我用于导航的 CSS 如下:

#navigation {
    background: rgb(100,135,125); /* Old browsers */
    /* IE9 SVG, needs conditional override of 'filter' to 'none' */
    background: -moz-linear-gradient(top,  rgba(100,135,125,1) 0%, rgba(126,181,165,1) 50%,   rgba(126,181,165,1) 52%, rgba(143,190,174,1) 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(100,135,125,1)), color-stop(50%,rgba(126,181,165,1)), color-stop(52%,rgba(126,181,165,1)), color-stop(100%,rgba(143,190,174,1))); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top,  rgba(100,135,125,1) 0%,rgba(126,181,165,1) 50%,rgba(126,181,165,1) 52%,rgba(143,190,174,1) 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top,  rgba(100,135,125,1) 0%,rgba(126,181,165,1) 50%,rgba(126,181,165,1) 52%,rgba(143,190,174,1) 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top,  rgba(100,135,125,1) 0%,rgba(126,181,165,1) 50%,rgba(126,181,165,1) 52%,rgba(143,190,174,1) 100%); /* IE10+ */
    background: linear-gradient(top,  rgba(100,135,125,1) 0%,rgba(126,181,165,1) 50%,rgba(126,181,165,1) 52%,rgba(143,190,174,1) 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#64877d', endColorstr='#8fbeae',GradientType=0 ); /* IE6-8 */
}
/*  HOVER STATE OF NAV BAR  */
#navigation ul.nav > li:hover,
#navigation ul.nav > li a:hover,
ul.nav li.current_page_item a,
ul.nav li.current_page_parent a,
ul.nav li.current-menu-ancestor a,
ul.nav li.current-cat a,
ul.nav   li.li.current-menu-item a {
    background: rgb(100,135,125); /* Old browsers */
    /* IE9 SVG, needs conditional override of 'filter' to 'none' */
    background: -moz-linear-gradient(top,  rgba(100,135,125,1) 0%, rgba(136,197,158,1) 47%, rgba(196,233,188,1) 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(100,135,125,1)), color-stop(47%,rgba(136,197,158,1)), color-stop(100%,rgba(196,233,188,1))); /*   Chrome,Safari4+ */
    background: -webkit-linear-gradient(top,  rgba(100,135,125,1) 0%,rgba(136,197,158,1) 47%,rgba(196,233,188,1) 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top,  rgba(100,135,125,1) 0%,rgba(136,197,158,1) 47%,rgba(196,233,188,1) 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top,  rgba(100,135,125,1) 0%,rgba(136,197,158,1) 47%,rgba(196,233,188,1) 100%); /* IE10+ */
    background: linear-gradient(top,  rgba(100,135,125,1) 0%,rgba(136,197,158,1) 47%,rgba(196,233,188,1) 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#64877d', endColorstr='#c4e9bc',GradientType=0 ); /* IE6-8 */
    color: #ffffff;
} 
 #navigation { 
    background: rgb(100,135,125); /* Old browsers */ 
    /* IE9 SVG, needs conditional override of 'filter' to 'none' */ 
    background: -moz-linear-gradient(top,  rgba(100,135,125,1) 0%, rgba(126,181,165,1) 50%,   rgba(126,181,165,1) 52%, rgba(143,190,174,1) 100%); /* FF3.6+ */ 
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(100,135,125,1)), color-stop(50%,rgba(126,181,165,1)), color-stop(52%,rgba(126,181,165,1)), color-stop(100%,rgba(143,190,174,1))); /* Chrome,Safari4+ */ 
    background: -webkit-linear-gradient(top,  rgba(100,135,125,1) 0%,rgba(126,181,165,1) 50%,rgba(126,181,165,1) 52%,rgba(143,190,174,1) 100%); /* Chrome10+,Safari5.1+ */ 
    background: -o-linear-gradient(top,  rgba(100,135,125,1) 0%,rgba(126,181,165,1) 50%,rgba(126,181,165,1) 52%,rgba(143,190,174,1) 100%); /* Opera 11.10+ */ 
    background: -ms-linear-gradient(top,  rgba(100,135,125,1) 0%,rgba(126,181,165,1) 50%,rgba(126,181,165,1) 52%,rgba(143,190,174,1) 100%); /* IE10+ */ 
    background: linear-gradient(top,  rgba(100,135,125,1) 0%,rgba(126,181,165,1) 50%,rgba(126,181,165,1) 52%,rgba(143,190,174,1) 100%); /* W3C */ 
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#64877d', endColorstr='#8fbeae',GradientType=0 ); /* IE6-8 */ 
} 
/*  HOVER STATE OF NAV BAR  */ 
#navigation ul.nav > li:hover, 
#navigation ul.nav > li a:hover, 
ul.nav li.current_page_item a, 
ul.nav li.current_page_parent a, 
ul.nav li.current-menu-ancestor a, 
ul.nav li.current-cat a, 
ul.nav   li.li.current-menu-item a { 
    background: rgb(100,135,125); /* Old browsers */ 
    /* IE9 SVG, needs conditional override of 'filter' to 'none' */ 
    background: -moz-linear-gradient(top,  rgba(100,135,125,1) 0%, rgba(136,197,158,1) 47%, rgba(196,233,188,1) 100%); /* FF3.6+ */ 
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(100,135,125,1)), color-stop(47%,rgba(136,197,158,1)), color-stop(100%,rgba(196,233,188,1))); /*   Chrome,Safari4+ */ 
    background: -webkit-linear-gradient(top,  rgba(100,135,125,1) 0%,rgba(136,197,158,1) 47%,rgba(196,233,188,1) 100%); /* Chrome10+,Safari5.1+ */ 
    background: -o-linear-gradient(top,  rgba(100,135,125,1) 0%,rgba(136,197,158,1) 47%,rgba(196,233,188,1) 100%); /* Opera 11.10+ */ 
    background: -ms-linear-gradient(top,  rgba(100,135,125,1) 0%,rgba(136,197,158,1) 47%,rgba(196,233,188,1) 100%); /* IE10+ */ 
    background: linear-gradient(top,  rgba(100,135,125,1) 0%,rgba(136,197,158,1) 47%,rgba(196,233,188,1) 100%); /* W3C */ 
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#64877d', endColorstr='#c4e9bc',GradientType=0 ); /* IE6-8 */ 
    color: #ffffff; 
}

让我知道您的想法或可能导致这种情况的原因。我非常感谢任何帮助!

4

3 回答 3

1

将此添加到您的 CSS 中。

#navigation ul.nav .sub-menu li:hover , #navigation ul.nav .sub-menu li a:hover {background:none!important

你会得到你的解决方案。

于 2012-08-30T18:01:03.653 回答
0

取下过滤器标签并在 jquery 中处理菜单。它会影响菜单上的 2 个级别。

于 2012-12-20T19:47:24.043 回答
0

您的样式不使用 .sub-menu 类,您是否尝试使用以下类删除背景:

.sub-menu .menu-item {
  background: ...
于 2012-08-30T17:44:15.417 回答