在IE中显示下拉列表的问题

时间:2013-02-03 19:31:57

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

我不确定为什么这个下拉菜单不会出现在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 */
}

1 个答案:

答案 0 :(得分:0)

哪个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);