语法:

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;

相关文章:

  • 2022-01-06
  • 2021-12-05
  • 2021-12-05
  • 2021-12-02
  • 2022-12-23
  • 2021-12-05
猜你喜欢
  • 2021-06-25
  • 2022-12-23
  • 2021-12-04
  • 2021-12-12
  • 2022-12-23
  • 2021-12-05
相关资源
相似解决方案