产生随机色彩
function randomVal(val) {return Math.floor(Math.random() * (val + 1));
}
function randomColor() {return `rgb(${randomVal(255}, ${randomVal(255}, ${randomVal(255})`;
}
渐变色按钮
<button class="btn">
<span> 突变按钮 </span>
</button>
.btn {
padding: 1px;
color: #4cdbbc;
text-align: center;
white-space: nowrap;
cursor: pointer;
outline: none;
border: none;
background: -webkit-linear-gradient(left, #fff 0%, #fff 100%), linear-gradient(90deg, #47d998 0%, #01d5d8 100%);
background-clip: content-box, padding-box;
}
.btn span {background: linear-gradient(90deg, #47d998 0%, #01d5d8 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}