0
How to import random function in CSS?
4 ответов
+ 8
CSS is not a programming language.
- cannot do functions
to change the color randomly try a scripting language like javascript.
+ 3
if you have seen people using random() in css,they are using scss or some other css preprocessor
+ 1
Thank you.
0
if i needed to randomly change something in css i would use JS . here is example.
var look = new Array("green","red","blue")
function cool(){
paragraph = document.getElementByTagName("p")
paragraph.style.backgroundColor = look[Math.round(Math.random()* look.length)]
}
cool()