2 回答

TA貢獻1795條經(jīng)驗 獲得超7個贊
只是一個示例,您可以根據(jù)自己的喜好進行編輯。
/*I want this to be a gradient, but I cant figure out how*/
function myFunction(){
document.body.style.background= "linear-gradient(90deg, rgba(212,211,222,1) 0%, rgba(186,215,209,1) 26%, rgba(0,255,44,1) 100%)";
}
<html>
<body>
<button onclick="myFunction()">Green <em>Gradient</em></button>
</body>
</html>

TA貢獻1816條經(jīng)驗 獲得超6個贊
/*I want this to be a gradient, but I cant figure out how*/
function myFunction(){
document.body.style.background= "linear-gradient(90deg, rgba(212,211,222,1) 0%, rgba(186,215,209,1) 26%, rgba(0,255,44,1) 100%)";
}
<html>
<body>
<button onclick="myFunction()">Green <em>Gradient</em></button>
</body>
</html>
添加回答
舉報