I want to have a dynamic amount of divs (sometimes 3, sometimes 10 etc), which should be colored based on a color gradient (say green to red).
So, when there are only two divs, make the first one #0F0
, the second one #F00
.
But when there are 10 divs, make the first and last the same, but all those between change gradually from green to red.
Is there a way to do this with pure css? If not, how would you do it with javascript? I'm thinking about doing it with javascript right now, but it's gonna get reaaally complicated the way i think about it. any advice? thanks