一、使用CSS3属性
1/* for firefox */ 2background-image: -moz-linear-gradient(top,#fefefe,#ebebeb); 3/* for webkit core */ 4background-image: -webkit-gradient(linear,0 0,0 100%,from(#fefefe),to(#ebebeb));
二、IE9- 兼容性写法
1/* for IE6,7,8,9 */ 2filter: progid:DXImageTransform.Microsoft.gradient( 3 startcolorstr=#fefefe, 4 endcolorstr=#ebebeb, 5 gradientType=0 6);
参数:上面的滤镜代码主要有三个参数,依次是:
@ startcolorstr : gradientType=1代表横向渐变,gradientType=0代表纵向淅变
@ endcolorstr : startcolorstr=”色彩” 代表渐变渐变起始的色彩
@ gradientType : endcolorstr=”色彩” 代表渐变结尾的色彩
more information you can click here URL