Alternate table row colors with CSS
Hello everyone. I am styling a table and I want to have alternate row colors. I know that the obvious way to do that is to create two classes and attach the appropriate class to the row you want to change. But I want to know if there is a way to do it totally in the external sheet without adding to markup.
I was thinking that :nth-of-type(2) selecting the <tr> element would work, but that only makes the second row the alternate color right? Is there a pseudo class, or even a property that will alternate rows without adding anything to the markup?