我试图在类表“ratingHead”的表行之后对表行的偶数和奇数元素着色。当“.ratingHead”达到时,颜色应该重新启动。将CSS应用到跟随一个对等元素(具有子标题的表)的偶数和奇数元素
This image of the table may be more clear
下面是代码
<table class="evalTable">
<thead>
<tr><th></th></tr>
</thead>
<tbody>
<tr class="tableHeadings"></tr>
<tr class="ratingHead"></tr>
<tr class="tableItems></tr>
<tr class="tableItems></tr>
<tr class="tableItems></tr>
<tr class="tableItems></tr>
<tr class="tableHeadings"></tr> <-- Keeps repeating based on how much information
<tr class="ratingHead"></tr> is dynamically generated from the database
<tr class="tableItems></tr> <------------------------------------------------------->
</body>
</table>
这种结构是CSS我目前所面对的
tr.tableItems:nth-child(odd) {
background-color: rgb(233, 231, 239);
}
tr.tableItems:nth-child(even) {
background-color: #f9f9f9;
}
你需要证明代码的其余部分 – dippas 2014-11-24 22:27:05