div { border: 4px solid; border-image: linear-gradient(to right, #8f41e9, #578aef) 1; }
参考:
5种CSS实现渐变色边框(Gradient borders方法的汇总