1、线性渐变,也可以设置偏移量
background: linear-gradient(方向,color1 ,color2);
看看效果:
linear-gradient第一个参数指定 表示渐变的方向,从哪向哪渐变
to bottom 从上至下;to bottom right 从左上至右下;to right 从左至右;to up right 从左下至右上;
to up 从下至下;to up left 从右下至左上;to left 从右至左;to bottom left 从右上至左下
第二个参数 指定渐变色的开始颜色,第三个参数 指定渐变色的结束颜色
2、放射性渐变
background:radial-gradient([direction],color1,color2);
看看效果
第一个参数可选 ;指定扩散方向,参数前是不是要有at。
center center;left top;center top;right top;right center;right bottom;center bottom;left bottom