0

How to import random function in CSS?

20th May 2018, 9:18 AM
Aanisha Bhattacharyya
Aanisha Bhattacharyya - avatar
4 Respostas
+ 8
CSS is not a programming language. - cannot do functions to change the color randomly try a scripting language like javascript.
20th May 2018, 9:23 AM
Manual
Manual - avatar
+ 3
if you have seen people using random() in css,they are using scss or some other css preprocessor
20th May 2018, 9:37 AM
᠌᠌Code X
᠌᠌Code X - avatar
+ 1
Thank you.
20th May 2018, 9:45 AM
Aanisha Bhattacharyya
Aanisha Bhattacharyya - avatar
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()
5th Jul 2018, 6:41 AM
ivankoshan
ivankoshan - avatar