我遇到过这段代码:
$("#customTable tr:nth-child(odd)").addClass("newColour");
这会为表格的每个奇数行着色。
如何在 css 中处理而不是使用 jQuery 来执行它?
最佳答案
#customTable tr:nth-child(odd) {
background-color:#eee;
}
#customTable tr:nth-child(even) {
background-color:#fff;
}
关于jquery - 使用 css 样式而不是 jQuery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11762528/