css 设置渐变色

语法:

background-image: linear-gradient(direction, color-stop1, color-stop2, ...);

/* 从上到下,蓝色渐变到红色 */

linear-gradient(blue, red);

/* 渐变轴为45度,从蓝色渐变到红色 */

linear-gradient(45deg, blue, red);

/* 从右下到左上、从蓝色渐变到红色 */

linear-gradient(to left top, blue, red);

/* 从下到上,从蓝色开始渐变、到高度40%位置是绿色渐变开始、最后以红色结束 */

linear-gradient(0deg, blue, green 40%, red);

0deg=to top;

90deg=to right;

180deg=to bottom;

-90deg=to left;

原文地址:https://www.cnblogs.com/LDJW/p/15702079.html