+ 13
Use : // Adding gradient to body document.body.style.backgroundImage = "linear-gradient(#DF2935, #FDCA40)"; // Adding gradient to div with id "color" document.getElementById("color").style.backgroundImage = "linear-gradient(#DF2935, #FDCA40, #3772FF)";
6th Nov 2022, 4:08 AM
Sujal
Sujal - avatar
+ 15
You can also refer to the below link here you can get further details about using linear gradient in css as well as in Javascript while scrolling down the page in detail https://blog.idrisolubisi.com/how-to-create-beautiful-gradients-with-javascript
6th Nov 2022, 4:27 AM
Suparna Das
Suparna Das - avatar