为什么删除没有样式的选择器包含条带表的标题?删除空选择器如何影响任何事情?
这是CSS:
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
TABLE.spreadsheet //if we delete this selector useless header becomes striped too
{
} //this selector seems useless at all
TABLE.spreadsheet TH
{
background: #ccc;
padding: 0px 3px;
text-align: center;
vertical-align: text-top;
}
TABLE.spreadsheet TD
{
text-align: center;
vertical-align: text-top;
padding: 0px 3px;
font-size: 14px;
}
TABLE.spreadsheet .odd
{
background-color: #ffefd5;
}
这是表格:
<table class="spreadsheet" cellspacing = "0">
<tr>
<th></th>
<th>Email Address</th>
<th>First Name</th>
<th>Last Name</th>
<th>Date</th>
<th>Phone</th>
<th>Action</th>
</tr>
<tr>
<td><input type="checkbox" name="bulk_select[]" id="bulk_select" value="2449831" class="bulk_select"></td>
<td>test@gmail.com</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td> <a href="/lists/edit-subscriber?id=2449831">edit</a>
<a href="/lists/delete-subscriber?id=2449831" class="del_subscriber">delete</a></td>
</tr>
<tr>
<td><input type="checkbox" name="bulk_select[]" id="bulk_select" value="2449880" class="bulk_select"></td>
<td>test48@gmail.com</td>
<td>Mark</td>
<td>Johnson</td>
<td></td>
<td></td>
<td> <a href="/lists/edit-subscriber?id=2449880">edit</a>
<a href="/lists/delete-subscriber?id=2449880" class="del_subscriber">delete</a></td>
</tr>
<tr>
<td><input type="checkbox" name="bulk_select[]" id="bulk_select" value="2449881" class="bulk_select"></td>
<td>test49@gmail.com</td>
<td>Chad</td>
<td>Davis</td>
<td></td>
<td></td>
<td> <a href="/lists/edit-subscriber?id=2449881">edit</a>
<a href="/lists/delete-subscriber?id=2449881" class="del_subscriber">delete</a></td>
</tr>
</table>
javascript到条带化表:
$("table.spreadsheet tr:nth-child(odd)").addClass("odd");