我正在尝试为在IE8和IE9上"优雅地"降级的按钮创建渐变效果。我有一个光滑的渐变按钮,我所做的是,为了在IE9中获得相同的光泽外观和感觉,我使用的是SVG背景图像。对于IE8,我决定失去光泽,只坚持基本的两档渐变,问题是一旦我广告过滤器,它也优先于IE9中的背景,我不希望发生。此问题是否有解决方法?以下是 CSS
input[type="button"], input[type="submit"], input[type="reset"], button {
padding: 3px 10px 3px 10px;
margin: 0;
border: none;
color: white;
outline: 0;
font-size: 0.875em;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
overflow: visible;
width: auto;
background: #094fa4;
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#009ee5', endColorstr='#094fa4',GradientType=0 );
background-image: url(../images/btn.svg);
background: -moz-linear-gradient(top, #2261ad 0%, #2261ad 50%, #094fa4 50%, #094fa4 100%);
background: -webkit-linear-gradient(top, #2261ad 0%, #2261ad 50%, #094fa4 50%, #094fa4 100%);
background: -ms-linear-gradient(top, #2261ad 0%, #2261ad 50%, #094fa4 50%, #094fa4 100%);
/*background:linear-gradient(to bottom, #2261ad 0%, #2261ad 50%, #094fa4 50%, #094fa4 100%);*/
border-top: 1px solid #4379B9;
border-bottom: 1px solid #08438C;
border-radius: 4px;
cursor: pointer;
}
您可以使用 CSS hack for IE8。这样写:
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#009ee5', endColorstr='#094fa4',GradientType=0 )9; //for IE8 & below.
background-image: url(../images/btn.svg);
阅读此内容以了解更多信息 http://www.gravitationalfx.com/css-hacks-for-ie-targeting-only-ie8-ie7-and-ie6/
或
您可以对不同的浏览器使用条件注释 http://www.quirksmode.org/css/condcom.html