我想要每张 table 的“斑马”外观。所以已经为每个表格设置的背景颜色需要重复出现,而不是像现在这样纯色。我如何才能使其他表格行都是白色的?
http://jsfiddle.net/Lance_Bitner/v8buo90L/
.tabs > div table tr td {
background: rgba(232, 240, 250, .5);
}
.tabs > div:nth-child(2) table tr td {
background: rgba(254, 217, 209, .5);
}
.tabs > div:nth-child(3) table tr td {
background: rgba(230, 198, 229, .5);
}
最佳答案
不需要 jquery 只需将 :nth-child(even)
添加到每一行就可以了。
.tabs > div table tr:nth-child(even) td {
background: rgba(232, 240, 250, .5);
}
.tabs > div:nth-child(2) table tr:nth-child(even) td {
background: rgba(254, 217, 209, .5);
}
.tabs > div:nth-child(3) table tr:nth-child(even) td {
background: rgba(230, 198, 229, .5);
}
你的 JQuery 也很好,只需要删除相关的 css (.tabs > div:nth-child(*) table tr td
) 就可以了,尽管它们都是蓝色阴影.
关于jquery - 如何使每张 table 的背景色重复出现?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37346941/