Alternating List Background Colors

Discussion in 'Web Design' started by sara.ortiz, Apr 23, 2014.

to remove all ads.
  1. sara.ortiz

    sara.ortiz New Member

    Messages:
    8
    I designed the Danville, IL YMCA website. (http://www.danvilleymca.org/programs.html) On their programs page we have the classes in a list tag. Each item has a different background color alternating light, dark, light, dark etc. They regularly update this list so whenever I add a new class I have to update the alternating colors as well so there isn't two items with a light background or two items with a dark background right next to each other.

    Is there an easier way to do this so I don't have to update the background colors each time? Any ideas would be appreciated.
     
  2. Edge

    Edge Member

    Messages:
    461
    supported by modern browsers:

    li:nth-child(odd) { background-color:#whatever }
    li:nth-child(even) { background-color:#amibovvered }
     
  3. sara.ortiz

    sara.ortiz New Member

    Messages:
    8
    Thank You!!! It worked.
     
  4. Edge

    Edge Member

    Messages:
    461
    You're welcome
     

Share This Page