渐变
–可以在两个或多个指定的颜色之间显示平稳的过渡
1,线性渐变
–沿着一根轴线改变颜色,从起点到终点颜色进行顺序渐变``
background:linear-gradient(direction,color-stop1,color-stop2,...);
(1)方向
默认为从上到下
从左到右
background: -webkit-linear-gradient( begin-direction,color-stop1,color-stop2,...);
background: -moz-linear-gradient( end-direction,color-stop1,color-stop2,...);/*火狐*/
background: -o-linear-gradient( end-direction,color-stop1,color-stop2,...);
background: linear-gradient(to end-direction,color-stop1,color-stop2,...);/*标准*/
/*例如*/
background: linear-gradient(to left,color-stop1,color-stop2,...);
对角
background: linear-gradient(to end-level end-vertical,color-stop1,color-stop2,...);/*标准*/
/*例如*/
background: linear-gradient(to left bottom,color-stop1,color-stop2,...);
角度
background: linear-gradient(angle,color-stop1 ,color-stop2 ,...);
0deg:从下往上;90deg:从左往右
线性渐变颜色结点
background:linear-gradient(
color1 length | percentage,
color2 length | percentage,
...
);
/*---重复渐变--*/
background: repeat-linear-gradient(
deg,
color1 length | percentage,
color2 length | percentage,
);
2,径向渐变
–后续更新