IE 8. Gradient background+image

2019-03-03 08:26发布

问题:

How can I make IE8 show a gradient background + image. This is possible in other browsers, but in IE it doesn't work.

In other browsers:

/* Opera */ 
background-image: url(gxt/images/my/eye.png) , -o-linear-gradient(top, #FFFFFF 0%, #EFCA11 100%);
/* Webkit (Safari/Chrome 10) */ 
background-image:url(gxt/images/my/eye.png) , -webkit-gradient(linear, left top, left bottom, color-stop(0, #FFFFFF), color-stop(1, #EFCA11));

回答1:

I found the answer to my question:

filter: progid:DXImageTransform.Microsoft.gradient( startColorstr="#FFFFFF", endColorstr="#EFCA11",GradientType=0 ), progid:DXImageTransform.Microsoft.AlphaImageLoader(src="gxt/images/my/eye.png"); 


回答2:

IE8 doesn't support CSS gradients (so that won't work). IE9 has limited support as far as I remember and IE10 will feature full support. I'm not sure what you're trying to do, but in case you'd like a background image with a gradient before or behind, how about stacking two images (one with the gradient, one with the actual background) or merging both into one image?