CSS 通过 linear-gradient()
函数来创建一个表示两种或多种颜色的线性渐变的“图像”;其结果属于 <gradient> 数据类型,是一种特别的 <image>数据类型。
语法:
background-image: linear-gradient(direction, color-stop1, color-stop2, ...);
-
direction
渐变的方向to + 方向(top、right、bottom、left)
或角度0deg~360deg
;to top, to bottom, to left 和 to right 这些值会被转换成角度0度、180度、270度和90度。 -
color-stop
渐变的起止颜色;至少要有两种颜色
渐变从上到下:
div{
width