2013-02-14 29 views
4

交替錶行顏色我使用<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> 

現在我想改變我background color for alternate rows怎麼能做到這一點的表數據????

在此先感謝

回答

1

使用此

tr td{ 
     background:yellow 
    } 
    tr:nth-child(odd) td{  
     background:red 
    } 

DEMO

2

CSS:

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