0

我在 IE 中遇到渐变问题,它没有像我希望的那样显示。

我创建了一个灰色渐变按钮,当你将鼠标悬停在它上面时它会变暗。它在 firefox 或 chrome 中的显示方式没有问题,这似乎只是 Internet Explorer 的问题。

html:

<input type="submit" value="Search" class="button1">

CSS:

.button1{
    height:26px;  font-family:verdana,arial, helvetica, sans-serif;  font-size:12px;  font-weight:bold;   
    cursor:pointer;  
    padding-left:10px;   padding-right:10px;  margin:2px;  
    border:1px solid #000;   float:left;
    -webkit-border-radius: 5px; 
    -moz-border-radius: 5px;   
    border-radius: 5px;
    background-color:#CCC;
    background: rgb(254,255,232); /* Old browsers */
    background: -moz-linear-gradient(top,  rgba(254,255,232,1) 0%, rgba(214,219,191,1) 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(254,255,232,1)), 
        color-stop(100%,rgba(214,219,191,1))); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top,  rgba(254,255,232,1) 0%,rgba(214,219,191,1) 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top,  rgba(254,255,232,1) 0%,rgba(214,219,191,1) 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top,  rgba(254,255,232,1) 0%,rgba(214,219,191,1) 100%); /* IE10+ */
    background: linear-gradient(to bottom,  rgba(254,255,232,1) 0%,rgba(214,219,191,1) 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#feffe8', endColorstr='#d6dbbf',GradientType=0 ); /* IE6-9 */
}

.button1:hover{
    background: -webkit-gradient(linear, left top, left bottom, from(#E6E6E6), to(#fff));/*for webkit*/
    background: -moz-linear-gradient(top,  #E6E6E6,  #fff);/*for firefox*/
    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#E6E6E6', endColorstr='#fff',GradientType=0);/*for IE*/  
}

jsfiddle:http: //jsfiddle.net/Wg65Y/

4

1 回答 1

0

IE 对 CSS 的支持对于开发人员来说是一场噩梦,在渐变的情况下可能更糟糕。

您需要的是Internet Explorer 的 CSS3 解决方案

于 2013-07-28T12:52:38.867 回答