In HTML - I need to format a table to highlight every other row. I have tried adding tr:nth-child(even) but I don't think I'm adding it in the correct area of the style. Any help is appreciated. Thank you!
<html>
<style> .ks-repeat {background-color: #FFFF66;}
</style>
<style type="text/css">caption.AcctgTableFormat
{
background-color: #f9fafd;
color:black;
border-style:solid;
border-width:1px;
border-color:#8c756a;
text-align:center;
}
table.AcctgTableFormat
{
font-family:Tahoma;
border-collapse:collapse;
font-size:10pt;
background-color:#ddf4ff;
border-style:solid;
border-color:#3e4560;
border-width:1px;
}
th.AcctgTableFormat
{
font-size:10pt;
color:Black;
border-style:solid;
border-color:#3e4560;
border-width:1px;
text-align:center;
font-weight:bold;
}
tr.AcctgTableFormat
{
}
td.AcctgTableFormat
{
font-size:10pt;
background-color: white;
color:black;
border-style:solid;
border-width:1px;
border-color: #3e4560;
text-align:left;
padding:3px;
}
</style>
<table class="AcctgTableFormat k-table" style="width:1010.39px;">
<caption class="AcctgTableFormat">
</caption>
<thead>
<tr class="AcctgTableFormat">
<th class="AcctgTableFormat" data-role="resizable" style="width:50px;">Customer No
</th>
<th class="AcctgTableFormat" data-role="resizable" style="width:100px;">Customer Name
</th>
<th class="AcctgTableFormat" data-role="resizable" style="width:20px;">Type
</th>
<th class="AcctgTableFormat" style="width:100px;" data-role="resizable">Balance
</th>
</tr>
</thead>
<tbody class="ks-repeat"><!--BEGIN*REPEAT-->
<tr class="AcctgTableFormat">
<td class="AcctgTableFormat" style="width:50px;">{CustomerNo}
</td>
<td class="AcctgTableFormat" style="width:100px;">{CustomerName}
</td>
<td class="AcctgTableFormat" style="width:20px;">{CustomerType}
</td>
<td class="AcctgTableFormat" style="width:100px;text-align:right;">{CurrentBalance$}
</td>
</tr>
<!--END*REPEAT--></tbody>
</tbody>
</tbody>
</tbody>
</tbody>
</tbody>
</table>
</html>
tr.AcctgTableFormat:nth-child(even) {background: #CCC!important;}
tr.AcctgTableFormat:nth-child(odd) {background: #FFF!important;}
https://jsbin.com/tenuhufowa/edit?html,output
Open in new window