【问题标题】:Having an issue with dropdown showing in IE在 IE 中显示下拉菜单时出现问题
【发布时间】:2013-02-03 19:31:57
【问题描述】:

我不确定为什么这个下拉菜单不会出现在 IE 中。任何人都可以看到问题是什么?它适用于所有其他浏览器,但不适用于 IE。我知道 IE 中的渐变需要很多思考。这是我的代码。

.menu { 
   border: 1px solid #ccc;
   background: #006699; /* Old browsers */
   background: -moz-linear-gradient(top,  #006699 0%, #1f416b 100%); /* FF3.6+ */
   background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#006699), color-stop(100%,#1f416b)); /* Chrome,Safari4+ */
   background: -webkit-linear-gradient(top,  #006699 0%,#1f416b 100%); /* Chrome10+,Safari5.1+ */
   background: -o-linear-gradient(top,  #006699 0%,#1f416b 100%); /* Opera 11.10+ */
   background: -ms-linear-gradient(top,  #006699 0%,#1f416b 100%); /* IE10+ */
   background: linear-gradient(to bottom,  #006699 0%,#1f416b 100%); /* W3C */
   filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#006699', endColorstr='#1f416b'); /* IE6-9 */  
}

.menu li a {
   padding: 15px 45px;
   text-decoration: none;
   font-size: 0.9em;
   color: #fff;
   font-family: Arial, sans-serif;      
}

.menu li.current > a,
.menu li.current > a:hover,
.menu li.current.hover > a {
   background: rgb(70,168,217); /* Old browsers */
   background: -moz-linear-gradient(top, rgba(122,188,255,1) 0%, rgba(96,171,248,1) 44%, rgba(64,150,238,1) 100%); /* FF3.6+ */
   background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(122,188,255,1)), color-stop(44%,rgba(96,171,248,1)), color-stop(100%,rgba(64,150,238,1))); /* Chrome,Safari4+ */
   background: -webkit-linear-gradient(top, rgba(122,188,255,1) 0%,rgba(96,171,248,1) 44%,rgba(64,150,238,1) 100%); /* Chrome10+,Safari5.1+ */
   background: -o-linear-gradient(top, rgba(122,188,255,1) 0%,rgba(96,171,248,1) 44%,rgba(64,150,238,1) 100%); /* Opera11.10+ */
   background: -ms-linear-gradient(top, rgba(122,188,255,1) 0%,rgba(96,171,248,1) 44%,rgba(64,150,238,1) 100%); /* IE10+ */
   filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7abcff', endColorstr='#4096ee',GradientType=0 ); /* IE6-9 */
   background: linear-gradient(top, rgba(122,188,255,1) 0%,rgba(96,171,248,1) 44%,rgba(64,150,238,1) 100%); /* W3C */
   color: #fff;
   text-shadow: 0px -1px 0px rgba(0,0,0,0.2);
   cursor: default;
}

.menu li a:hover,
.menu li.hover > a {
   background: #b32416; /* Old browsers */
   background: -moz-linear-gradient(top,  #b32416 0%, #8f0222 44%, #6d0019 100%); /* FF3.6+ */
   background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#b32416), color-stop(44%,#8f0222), color-stop(100%,#6d0019)); /* Chrome,Safari4+ */
   background: -webkit-linear-gradient(top,  #b32416 0%,#8f0222 44%,#6d0019 100%); /* Chrome10+,Safari5.1+ */
   background: -o-linear-gradient(top,  #b32416 0%,#8f0222 44%,#6d0019 100%); /* Opera 11.10+ */
   background: -ms-linear-gradient(top,  #b32416 0%,#8f0222 44%,#6d0019 100%); /* IE10+ */
   background: linear-gradient(to bottom,  #b32416 0%,#8f0222 44%,#6d0019 100%); /* W3C */
   filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b32416', endColorstr='#6d0019'); /* IE6-9 */
}

【问题讨论】:

  • 我使用这个网站来创建我所有的渐变。总是有效。 colorzilla.com/gradient-editor
  • 我们能在 jsFiddle 上举个例子吗?
  • @VukašinManojlović 是的,我将在 FS fiddle 中上传一个示例并提供一个链接。
  • @fredsbend 我会试试看它是否有效。我也将其用于功能参考!

标签: css internet-explorer drop-down-menu navigation gradient


【解决方案1】:

哪个IE版本?

我知道你的 html 页面的头部需要这样的东西。与SVG或其他东西有关。条件格式。

<!-- following class is conditional for IE9 and must be put in elements for css gradient to work -->
<!--[if gte IE 9]>
  <style type="text/css">
    .gradient {
       filter: none;
    }
  </style>
<![endif]-->

然后将这个渐变类应用到使用渐变的元素上。

http://www.colorzilla.com/gradient-editor/

编辑

好的。做了一些研究,发现过滤器应该有一个 8 位十六进制代码,其中前两个是不透明度。我认为 FF 代表 100%,00 代表 0%。另外,使用双引号“。可能会有所作为。

所以做这样的事情:

filter:progid:DXImageTransform.Microsoft.gradient
(startColorstr="#ff7abcff",endColorstr="#ff4096ee",GradientType=0); 

【讨论】:

  • 它不工作的 IE 版本是 IE8。这是我所指的页面的链接(condley.com/condley-llp)。 Nav 可以在所有其他浏览器中使用,只是在 IE8 中没有。
  • 我尝试了该编辑,但当我将鼠标悬停在下拉菜单上时,我仍然没有得到任何东西。
  • @Ajay 你确定是梯度引起的问题吗?删除所有渐变,然后查看下拉菜单是否显示在 IE8 上。默认960中“菜单样式”下的所有东西。更改为简单的一种颜色十六进制。如果它确实显示,那么它是导致问题的梯度,如果没有,那么它不是梯度。我认为 IE8 有开发者工具;您可以一次删除一种样式,而无需编辑页面。在页面上时按 F12。
  • 你是对的。一旦我检查了 IE8 中的开发人员工具并开始禁用样式。下拉菜单仍然不起作用。所以我猜是JS。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-03-29
  • 2011-08-19
相关资源
最近更新 更多