1、何谓渐变?
让背景色在多个颜色中平稳过渡。
所谓平稳,类似于左图这样
谁要跟你说右图是渐变,你可以拿出你鼠标垫下39米长的大刀让他先跑40米… …
2、渐变介绍
线性渐变----->linear-gradient()
语法:
background: linear-gradient(direction, color-stop1, color-stop2, …);
它其实是个功能函数,包含多个参数;
direction:控制渐变的方向、默认是to bottom 到下,即从上到下;
例:
background: linear-gradient(to right,red,yellow);
红到黄向右渐变,结果:
background: linear-gradient(to top,red,yellow);
红到黄向上渐变