Gradient colors in Internet Explorer

前端 未结 11 802
青春惊慌失措
青春惊慌失措 2020-12-04 09:31

I know that Internet Explorer has some proprietary extensions so that you can do things like create divs with a gradient background. I can\'t remember the element name or i

11条回答
  •  鱼传尺愫
    2020-12-04 10:06

    A significant gotcha when it comes to gradients in IE is that although you can use Microsoft's filters...

    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FCCA6D', endColorstr='#FEFEFE');
    zoom:1;
    

    ...they kill clear type on any text covered by the gradient. Given that the purpose of gradients is normally to make the UI look better, that's a show stopper for me.

    So for IE I use a repeating background image instead. If the background image css is combined with the gradient CSS for other browsers (as per Blowsie's answer), other browsers will ignore the background image in favour of the gradient css, so it will only end up applying to IE.

    background-image: url('/Content/Images/button-gradient.png');
    

    There are plenty of sites you can use to quickly generate a gradient background; I use this.

提交回复
热议问题