Change BG Color of the row repeating in loop dynamically data

Hi,
I am having a single row which repeat dynamically.
My issue is i want to make alternate colors in rows. (i.e white n gray)

I can put the class for the row. but when it repeats it get the same bg color.

How can i do the alternate thing.?

Please Help

Thanks
Vikas

post the code that generates the rows

Have you tried using the CSS code that deals with odd/even rows?


tr:nth-child(odd) {
    background-color:#fff;
}
tr:nth-child(even) {
    background-color:#ccc;
}

Hi i dont hv any idea how to use this…Can u give me any example for this?

http://www.zones.com/site/product/index.html?id=003011191&page_name=product_accessories&zone=business

plz check this

It looks like you are using CSS to create fake tables on your site. It is okay to use tables for tabular data, such as your list of cables and desktop accessories. It is even beneficial, in that achieving odd/even rows then becomes a simple effect to create.


<table>
    <thead>
        <tr>
            <th>Item #</th>
            <th>Description</th>
            ...
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>03153115</td>
            <td><a href="...">Belkin SuperSpeed USB 3.0 A to B (Male/Male) Cable 3</a></td>
            ...
        </tr>
        ...
    </tbody>
</table>