简体   繁体   English

Internet Explorer按钮CSS

[英]Internet Explorer button CSS

I am using a gradient for my button background color, and this only works in non IE browsers. 我使用渐变作为我的按钮背景颜色,这仅适用于非IE浏览器。 I am trying to set a solid background color for IE. 我试图为IE设置一个坚实的背景颜色。 When I place the background style before the background gradients in the stylesheet, it simply doesn't show up. 当我将背景样式放在样式表中的背景渐变之前时,它根本不显示。 When I place it after, it overrides the gradient in all browsers. 当我放置它之后,它会覆盖所有浏览器中的渐变。

Without it, my button is completely transparent. 没有它,我的按钮是完全透明的。 Can someone help me figure out how to give a background color only to IE? 有人可以帮我弄清楚如何只为IE提供背景颜色吗? (versions 8 and 9) Or even better.. to set a gradient? (版本8和9)或甚至更好..设置渐变?

Here is the CSS which works in browsers except IE. 这是在IE以外的浏览器中使用的CSS。 The solid background color doesn't show up at all though: 完整的背景颜色根本不显示:

button {
        background: #3485bf;
    background: -moz-linear-gradient(
        top,
        #59a3d4 0%,
        #3485bf);
    background: -webkit-gradient(
        linear, left top, left bottom, 
        from(#59a3d4),
        to(#3485bf));
}

try to use Filters. 尝试使用过滤器。 Something like 就像是

filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#59a3d4', endColorstr='#3485bf');

should do the job for you. 应该为你做的工作。

See Transitions and Filters 请参阅转换和过滤器

This link explains how to get gradients working in all modern browsers, and then including fall back background colors if on older browsers: 此链接说明如何在所有现代浏览器中使用渐变,然后在旧版浏览器中包含后退背景颜色:

http://css-tricks.com/css3-gradients/ http://css-tricks.com/css3-gradients/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM