如何在Internet explorer中连接背景图像和渐变



我正在使用CSS在元素上放置渐变和背景图像。我从Colorzilla开始寻找梯度,它给了我这个。

background: rgb(250,250,250);
background: -moz-linear-gradient(left,  rgba(250,250,250,1) 0%, rgba(236,236,236,1) 100%);
background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(250,250,250,1)), color-stop(100%,rgba(236,236,236,1)));
background: -webkit-linear-gradient(left,  rgba(250,250,250,1) 0%,rgba(236,236,236,1) 100%);
background: -o-linear-gradient(left,  rgba(250,250,250,1) 0%,rgba(236,236,236,1) 100%);
background: -ms-linear-gradient(left,  rgba(250,250,250,1) 0%,rgba(236,236,236,1) 100%);
background: linear-gradient(to right,  rgba(250,250,250,1) 0%,rgba(236,236,236,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fafafa', endColorstr='#ececec',GradientType=1 );

这适用于所有主要浏览器,包括Internet Explorer(至少在IE9中)。

然后我手动添加了背景图像。

background: url('/public/src/images/features_arrow_fade.png') no-repeat 260px center, rgb(250,250,250);
background: url('/public/src/images/features_arrow_fade.png') no-repeat 260px center, -moz-linear-gradient(top,  rgba(250,250,250,1) 0%, rgba(236,236,236,1) 100%);
background: url('/public/src/images/features_arrow_fade.png') no-repeat 260px center, -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(250,250,250,1)), color-stop(100%,rgba(236,236,236,1)));
background: url('/public/src/images/features_arrow_fade.png') no-repeat 260px center, -webkit-linear-gradient(top,  rgba(250,250,250,1) 0%,rgba(236,236,236,1) 100%);
background: url('/public/src/images/features_arrow_fade.png') no-repeat 260px center, -o-linear-gradient(top,  rgba(250,250,250,1) 0%,rgba(236,236,236,1) 100%);
background: url('/public/src/images/features_arrow_fade.png') no-repeat 260px center, -ms-linear-gradient(top,  rgba(250,250,250,1) 0%,rgba(236,236,236,1) 100%);
background: url('/public/src/images/features_arrow_fade.png') no-repeat 260px center, linear-gradient(to bottom,  rgba(250,250,250,1) 0%,rgba(236,236,236,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fafafa', endColorstr='#ececec',GradientType=0 );

这可以在除IE之外的所有主要浏览器中正确显示带有图像的渐变。IE只显示渐变。我怎样才能让它也在IE中工作?如果jQuery有帮助的话,我愿意使用它!

您将需要创建另一个元素,这在=<IE9使用多个背景

最新更新