Zebra stripes on table rows using Rails / RHTML
1 <% @projects.each_with_index do |project, i| %> 2 <% row_class = i%2 == 0 ? "even" : "odd" %> 3 <tr class="<%= row_class %>"> 4 ...... 5 <% end %>
In the CSS:
1 TR.even { background-color: #f00; } 2 TR.odd { background-color: #f00; }
etc..