Change background colour of individual elements on the fly

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-04-29T14:33:01Z Indexed on 2010/04/29 14:37 UTC
Read the original article Hit count: 282

Filed under:
|
|

Hi,

Is there a way in CSS or JQuery where I can dynamically change the background of li tags so they get slightly lighter for each element until it gets to white.

For example say I had a list of 10 li elements. The first would have a red (#ff0000) background, the next one would then be a lighter shade of red, and so on and so on until we got to the last one which would have a background of white (#FFFFFF)

The list can be any length and i just want the background colour to go from one colour e.g. red to another colour e.g. white. My site uses JQuery so if I have to use that I don't mind.

Thanks

© Stack Overflow or respective owner

Related posts about css

Related posts about jquery-css