0

我有一个渐变应用到一个 div,它是从浅灰色到稍深的灰色,它适用于除 IE8 之外的所有浏览器。我无权访问 css,所以我不得不使用 jquery 应用这些样式,但它们似乎适用于所有其他浏览器,所以我不确定为什么它不适用于 IE。这是代码:

$(document).ready(function() {
//Build your CSS.
var gradient1 = {
    "background": "-moz-linear-gradient(top,  #fbfbfb 0%, #f4f4f5 100%)"
};
var gradient2 = {
    "background": "-webkit-linear-gradient(top,  #fbfbfb 0%,#f4f4f5 100%)"
};
var gradient3 = {
    "background": "-o-linear-gradient(top,  #fbfbfb 0%,#f4f4f5 100%)"
};
var gradient4 = {
    "background": "-ms-linear-gradient(top,  #fbfbfb 0%,#f4f4f5 100%); /* IE10+ */ background: linear-gradient(to bottom,  #fbfbfb 0%,#f4f4f5 100%)"
};
var gradient5 = {
    "filter": "progid:DXImageTransform.Microsoft.gradient(startColorstr=#fbfbfb, endColorstr=# f4f4f5)"
};
var gradient6 = {
    "-ms-filter": "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#fbfbfb', endColorstr='#f4f4f5')"
};
var blue_background = {
    "background": "#eff5f8"
};


//Apply your CSS to the body tag.  You can enter any tag here, as
//well as ID's and Classes.
$(".gradient_1").css(gradient1);

$(".gradient_2").css(gradient2);

$(".gradient_3").css(gradient3);

$(".gradient_4").css(gradient4);

$(".gradient_5").css(gradient5);

$(".gradient_6").css(gradient6);


$(".blue").css(blue_background);

});

然后我将所有类应用于 div,渐变 1-6。div 的 html 是:

<div class="gradient_1 gradient_2 gradient_3 gradient_4 gradient_5 gradient_6"   
style="width: 690px; zoom: 1; display: block; margin-bottom: 15px; height: 100%;  
padding-top: 15px;">

该页面是http://www.brighamandwomens.org/Patients_Visitors/pcs/rehabilitationservices/mock/about.aspx 感谢您对此的任何帮助。

4

1 回答 1

0

IE 8 不支持渐变。您必须使用单一颜色或提供背景图像

于 2012-10-11T15:40:44.847 回答