Random Quote Machine CSS

Hi, how do I do the color changing with each new quote?

Do you have any ideas at all as to how you would do this? There are a variety of ways to accomplish this. I’d be interested to know what you think might work.

I was thinking of using the “var” like in the template but looking for ideas to be more original

You mean defining an array of colors and then randomly picking a color from that array each time you display a new quote and assigning that color to the quote text? Yes, that would definitely work. Underneath, it’s just setting CSS properties on the text, so you could also define a class for each different color you want to use and then define all of the associated properties for each class in your stylesheet and just change the class on the quote text each time you show a new one.

There are probably other considerations to take into account too depending on how fancy you want to get with animations and transitions and how you implement those. Basically, there is no one right answer here. You should do whatever makes sense with the approach and tools you are using to create this application.

Ok thanks I’m busy searching for some ideas before I do anything further.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.