How to change alternate row colors in racks

I use the <logic:iterator> to display table data such as

  <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> 

Now I want to change the background color for alternate rows , how can I do this ????

early

+4
source share
2 answers

Use this

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

Demo

+1
source

CSS

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

All Articles