-
线性渐变
linear-gradient([point||angle],<color [startpos]>,<color [endpos]>[,<color pos>]*);
ponit/angle参数值:
(1)to left:设置渐变从右到左,相当于270deg
(2)to right:设置渐变从左到右,相当于90deg
(3)to top:设置渐变从下到上,相当于0deg
(4)to bottom:设置渐变从上到下,相当于180deg
<color [startpos]>:设置起始颜色、起始位置(可选)
<color [endpos]>:设置终点颜色、终点位置(可选)
后面可以加更多的颜色(和位置),表示多种颜色渐变
-
径向渐变
radial-gradient([shape],[size],[at <position>],[startpos]>,<color [endpos]>[,<color pos>]*);
shape参数值(可选):circle|ellipse(适配当前形状)
size(可选):渐变的大小
closest-side:最近边
farthest-side:最远边
closest-corner:最近角
farthest-corner:最远角(默认值)
at <position>(可选):圆心坐标位置,默认为at center center
<color [startpos]>:设置起始颜色、起始位置(可选)
<color [endpos]>:设置终点颜色、终点位置(可选)
后面可以加更多的颜色(和位置),表示多种颜色渐变
-
重复渐变
repeating-linear-gradient(语法同上);
repeating-radial-gradient(语法同上);