tr:nth-child(even) help. how to apply to one class?
css, css-selectors, css-tables
Solution
Use the CSS descendant combinator (juxtaposition) as usual:
table.dashboardtable tr:nth-child(even)
table.dashboardtable tr:nth-child(odd)
Problem
I'm not very good with CSS and I need some help. I have a table where i want every other row to be gray and the alternating rows to be white. but i only want it to happen on one particular table. I added some code to my CSS: ``` tr:nth-child(even) { background: #CCC; } tr:nth-child(odd) { background: #FFF; } ``` but the problem is that its affecting every table on my site. I haven't found any examples where it applies only to a certain class. Is that possible? I want it to apply only to: ``` table.dashboardtable ```