前段时间我写过一篇:CSS中background属性总结 整理了background的常用属性。
在CSS3中 background-image 还有一个 gradient 属性——渐变。...: linear-gradient(to right top,red,blue); /*从左下角到右上角*/
效果如下:
多色渐变:可以有多个颜色的值
background-image: linear-gradient...(to right top,red,orange,yellow,green,cyan,blue,purple); /*从左下到右上 颜色。。。.../
效果如下:
重复渐变:两种颜色重复渐变
background-image: repeating-linear-gradient(to left,black 30px,white 60px); /*从右向左渐变...,黑色渐变30px,白色从30px开始到60px,总共占60px,重复出现,后面的值要比前面的大。