Css背景颜色渐变,兼容多浏览器 IE6、IE7、IE8、FF、Opera、Chorme、Safari
filter:progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#ffffff,endColorStr=#0000ff); / * IE 6 7 8 * /background: -ms-linear-gradient(top, #fff, #0000ff); / * IE 10 * /
background: -moz-linear-gradient(top, #fff,#0000ff); / * Firefox 3.6+ * /
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff),to(#0000ff)); / * Safari 4-5, Chrome 1-9 * /
background: -webkit-linear-gradient(top, #fff,#0000ff); / *Safari5.1 Chrome10+* /
background: -o-linear-gradient(top, #fff,#0000ff); / * Opera 11.10+*/
用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);"