每日知识总结

颜色渐变

2017-12-25  本文已影响3人  ZhongQw

线性渐变:background : linear-gradient(起始颜色到结束颜色)

#grad {
  background: -webkit-linear-gradient(red, blue); /* Safari 5.1 - 6.0 */
  background: -o-linear-gradient(red, blue); /* Opera 11.1 - 12.0 */
  background: -moz-linear-gradient(red, blue); /* Firefox 3.6 - 15 */
  background: linear-gradient(red, blue); /* 标准的语法 */
}

还可以指定角度

 background: linear-gradient(to right, red , blue);
 background: linear-gradient(to bottom right, red , blue);
background: linear-gradient(angle, color-stop1, color-stop2);
background: linear-gradient(red 1%, green 8%, blue 90%); 
  background: linear-gradient(to right, rgba(255,0,0,0), rgba(255,0,0,1)); 

径向渐变

background: radial-gradient(center, shape size, start-color, ..., last-color);

circle 是圆
ellipse 默认是椭圆

    background: radial-gradient(circle, red, yellow, green); 

上一篇下一篇

猜你喜欢

热点阅读