Is it possible to generate random color with pure CSS and without using javascript? It\'s probably impossible but I\'m still curious.
Not exactly random but with CSS:
Step 1 - Select queried backgrounds, order them in sequence and adjust the frequency
@keyframes bgrandom {
0% { background: linear-gradient(90deg, rgba(255,255,255,0.98) 50%, rgba(255,255,255,0.96) 0%); }
50% { background: linear-gradient(90deg, rgba(255,255,255,0.98) 50%, rgba(255,255,255,0.96) 0%); }
55% { background: linear-gradient(90deg, rgba(255,255,255,0.96) 50%, rgba(255,255,255,0.98) 0%); }
80% { background: linear-gradient(90deg, rgba(255,255,255,0.96) 50%, rgba(255,255,255,0.98) 0%); }
85% { background: linear-gradient(90deg, rgba(255,255,255,0.96) 50%, rgba(255,255,255,0.94) 0%); }
100% { background: linear-gradient(90deg, rgba(255,255,255,0.96) 50%, rgba(255,255,255,0.94) 0%); }
}
Step 2 - Launch the animation(length animationName repeatMode)
#element{ animation: 1.2s bgrandom infinite; }
Easy to use, customize and works great. Similar technique can be used for sliders, spinners, etc.