线性渐变
linear-gradient(direction,color)
写法:background:-webkit-linear-gradient(direction,color)
1.direction:方向,默认方向是自上而下;写法有:
1.background:-webkit-linear-gradient(to top right,color)
2.background:-webkit-linear-gradient(45deg,color)//正则顺时针,负则逆时针
2.color : 颜色
1.background:-webkit-linear-gradient(45deg,red,yellow)
2.background:-webkit-linear-gradient(45deg,red 10%,yellow 90%)//表示10%之前为红色,10%-90%为渐变色,90%-100%为黄色
重复渐变
repeating-linear-gradient()
径向渐变
radial-gradient()
radial-gradient(circle at center, red 0, blue, green 100%)
/* 从元素中心点渐变,起始色为red,渐变到blue,终止色为green*/
/*circle为正圆,ellipse为椭圆*/