效果:
style:
button[type=primary] {
background: linear-gradient(to right, #03A9F4, #7C4DFF);
}
注意這裏要使用background,而不能用background-color。
語法:
同css一樣:
linear-gradient( color1 , color2 );
默認從上到下,兩個參數即可,省去了第一個參數,第一個參數控制方向。
左右:
background: linear-gradient(to right, #03A9F4, #7C4DFF);
對角:
background: linear-gradient(to bottom right, #03A9F4, #7C4DFF);
更多可查看:https://www.runoob.com/css3/css3-gradients.html