I want to style the odd and even rows of the <tr> selector of a <table>.
There are multiple tables on the page and I only want to apply to a specific one.
Is it possible to use what I have below (or something similar) to only apply to a specific table without applying to every <tr> element on the page in every table?
tr:nth-child(even) td {
background: #F1F1F1;
}
tr:nth-child(odd) td {
background: #FEFEFE;
}
//here is my table
<table id="customDatesTable" class="tableStyle tableMaxWidth">
<tr>
<th width='15' align="left">
Start Date
</th>
<th width="23" align="left">
End Date
</th>
<th width="6" align="left">
Intake#
</th>
<th width="10" align="left">
Intake?
</th>
</tr>
@foreach (var date in Model.CustomDates)
{
<tr>
<td>@date.StartDate</td>
<td>@date.EndDate</td>
<td class="paddingCurrentDates">@date.IntakeNumber</td>
<td class="paddingCurrentDates"><input type="checkbox"
checked="@(date.Intake)" id="intakeCheckBox" disabled /></td>
</tr>
}
</table>