日期:2014-05-17  浏览次数:20808 次

css控制背景颜色渐变
/*-----------由左至右渐变-------------*/

body{ width:100%; height:105px; margin:0 auto;
filter: progid:DXImageTransform.Microsoft.gradient(startcolorstr=#00108B,endcolorstr=white,gradientType=1);  /*IE*/
-ms-filter:progid:DXImageTransform.Microsoft.gradient(startcolorstr=#00108B,endcolorstr=white,gradientType=1);  /*IE8*/
background:white;   /* 一些不支持背景渐变的浏览器 */
background:-o-linear-gradient(left,#00108B 0%,white);  /*opera*/
background:-moz-linear-gradient(left, #00108B, white);  /*firefox*/
background:-webkit-gradient(linear, left top, right top, from(#00108B), to(rgba(0, 0, 255, 0)));}  /*chrome,safari*/




/*-----------由上至下渐变-------------*/


body{ width:100%; height:105px; margin:0 auto;
filter: progid:DXImageTransform.Microsoft.gradient(startcolorstr=#00108B,endcolorstr=white,gradientType=0);  /*IE*/
-ms-filter:progid:DXImageTransform.Microsoft.gradient(startcolorstr=#00108B,endcolorstr=white,gradientType=0);  /*IE8*/
background:white;   /* 一些不支持背景渐变的浏览器 */
background:-o-linear-gradient(top,#00108B 0%,white);  /*opera*/
background:-moz-linear-gradient(top, #00108B, white);  /*firefox*/
background:-webkit-gradient(linear, 0 0, 0 500, from(#00108B), to(rgba(0, 0, 255, 0)));}  /*chrome,safari*/