+ 1
[SOLVED] Is it possible to use CSS to change <div> elements background colour randomly
I was just trying to practice CSS animation (code attached), where in I used CSS animation to rotate some <div> elements inside the page. I want the <div> elements to also change their background colour randomly, but I need help with changing background colour using CSS. As it is now, colour changes is done with JS function, and doesn't look so smooth (the colour transition). Here's the code bit ... https://code.sololearn.com/W578sR21C8T7/?ref=app Thanks in advance 🙏
2 Réponses
+ 1
add CSS property in div selector
transition-duration :2s;
For smooth background color change
+ 1
Thank you Vadi velan
Works like magic! 👍👍👍