三种方式:
1.用border-image 来实现:
.box { width: 200px ; height: 200px ; border: 10px solid #ddd; border-image: linear-gradient(rgb(89, 0, 255),pink) 30 30; }
缺点:无法实现圆角radius
2.使用background-image实现:
.box1 { width: 200px; height: 200px; box-sizing: border-box; padding: 10px; border-radius: 50%; background-image: linear-gradient(top, pink 0%, blue 30%, yellow 60%, green 90%); } .box2 { width:100%; height:100%; border-radius:50%; background:#fff; }
使用两个box覆盖实现伪边框效果
3.使用background-clip,backgound-origin,backgound-image实现:
.border-box { border: 5px solid transparent; border-radius: 15px; background-clip: padding-box, border-box; background-origin: padding-box, border-box; background-image: linear-gradient(to right, #222, #222), linear-gradient(90deg, #8F41E9, #578AEF); }
标签:box,linear,gradient,渐变色,image,边框,background,border,CSS From: https://www.cnblogs.com/ericyjchung/p/16819084.html