Css背景颜色渐变,j兼容多浏览器 IE6、IE7、IE8、FF、Opera、Chorme、Safari

<td style="background:-webkit-gradient(linear, 0% 0%, 0% 100%, from(#1c97ff), to(#ffffff));FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#1c97ff,endColorStr=#ffffff);background: -moz-linear-gradient(top, #1c97ff, #ffffff);background: -o-linear-gradient(top, #1c97ff 0%,#ffffff 100%);">&nbsp;</td>

红色支持IE6、7、8,蓝色支持FF,绿色是Chrome,紫色为Opera。

 

<table cellpadding="0" cellspacing="0" width="72%" height="30" border="0">
<tr>
<td width="33%" height="300" style="filter:progid:DXImageTransform.Microsoft.Gradient
(startColorStr='#FFFFFF', endColorStr='#3568CC', gradientType='0')">1</td>
<td width="33%" height="300" style="filter:progid:DXImageTransform.Microsoft.Gradient
(startColorStr='#FFFFFF', endColorStr='#3568CC', gradientType='1')">2</td>
<td width="33%" height="300" style="filter:progid:DXImageTransform.Microsoft.Gradient
(startColorStr='#FFFFFF', endColorStr='#3568CC', gradientType='2')">3</td>
</tr>
</table>

用css实现网页背景渐变的代码如下:

一、从上往下渐变

Example Source Code:
body{
FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#ffffff,endColorStr=#000000);
}

二、从左上至右下渐变

Example Source Code:
body{
FILTER: Alpha( style=1,opacity=25,finishOpacity=100,
startX=50,finishX= 100,startY=50,finishY=100);
background-color: skyblue;
}

三、从左往右渐变

Example Source Code:
body{
FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=1,startColorStr=#ffffff,endColorStr=#000000);
}

一、从上往下渐变

Example Source Code:
body{
FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#ffffff,endColorStr=#000000);
}

二、从左上至右下渐变

Example Source Code:
body{
FILTER: Alpha( style=1,opacity=25,finishOpacity=100,
startX=50,finishX= 100,startY=50,finishY=100);
background-color: skyblue;
}

三、从左往右渐变

Example Source Code:
body{
FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=1,startColorStr=#ffffff,endColorStr=#000000);
}

四、从上往下渐变

Example Source Code:
style="filter:progid:DXImageTransform.microsoft.gradient(gradienttype=0,startColorStr=blue,endColorStr=white);"

五、从上往下渐变

Example Source Code:
style="filter:progid:DXImageTransform.microsoft.gradient(gradienttype=0,startColorStr=blue,endColorStr=white);"

你可能感兴趣的:(Css背景颜色渐变,j兼容多浏览器 IE6、IE7、IE8、FF、Opera、Chorme、Safari)