Zebra tables / Cycle table line color

Does anyone have a simple solution for doing zebra striping on tables so
I can cycle colors between even and odd lines? All the examples I have
found are code snippets and do not describe which directories/files to
add/modify the code.

Thanks,
Wayne

Wayne M. wrote in post #1006651:

Does anyone have a simple solution for doing zebra striping on tables so
I can cycle colors between even and odd lines? All the examples I have
found are code snippets and do not describe which directories/files to
add/modify the code.

Thanks,
Wayne

Hi, something I use in some tables:

<% @contents.each do |content| %>

">
One Two Three Four
<%= content.one %> <%= content.two %> <%= content.three %> <%= content.four %>

then in your CSS file you have definition for even_row and odd_row

.even_row {
background-color: #fff;
}

.odd_row {
background-color: #F8F3DD;
}

So the key here is <tr class="<%= cycle(“even_row”, “odd_row”) %>">
which selects a different class per row alternatively.

Hope this helped.

Cheers.