如何在Struts中更改交替表行颜色

3
我正在使用<logic:iterator>标签来显示表格数据,如下所示。
    <logic:iterate id="LT" name="lastToken" scope="request">
        <tr>
          <td class="TblHometd"><bean:write name="LT"  property="tokennumber" format="#"/></td>
          <td class="TblHometd"><bean:write name="LT"  property="adjustmenttime" format="hh:mm:ss"/></td>
          <td class="TblHometd"><bean:write name="LT"  property="actualfinishedtime" format="hh:mm:ss"/></td>
          <td class="TblHometd"><bean:write name="LT"  property="consultationtype"/></td>
          <td class="TblHometd"><bean:write name="LT"  property="mobileno" format="#"/></td>
          <td class="TblHometd"><bean:write name="LT"  property="consultationstatus"/></td>
          <td class="TblHometd"><bean:write name="LT"  property="smsstatus"/></td>
        </tr>
   </logic:iterate>

现在我想要更改交替行的背景颜色,我该怎么做???

提前感谢。

2个回答

2

CSS:

table#LT tr:nth-child(odd) {
    background-color: #F00; 
}

1
使用此代码。
    tr td{
       background:yellow
    }
   tr:nth-child(odd) td{    
      background:red
    }

演示


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接