线性渐变

从上到下(默认)

background-image: linear-gradient(red, yellow);

从左到右

background-image: linear-gradient(to right, red, yellow);

对角线: 从左上角 到右下角

background-image: linear-gradient(to bottom right, red, yellow);

使用角度: -90deg 相当于从右向左

background-image: linear-gradient(-90deg, red, yellow);

使用多个色标

background-image: linear-gradient(red, yellow, green);

使用多个色标: 彩虹色

background-image: linear-gradient(to right, red,orange,yellow,green,blue,indigo,violet);

使用透明度

background-image: linear-gradient(to right, rgba(255,0,0,0), rgba(255,0,0,1));

重复线性渐变

background-image: repeating-linear-gradient(red, yellow 10%, green 20%);