Short answer: you can't do it by CSS, unless you change your HTML structure.
More detail:
:last-of-type
pseudo-class, represents the element which is the last sibling of its type in the list of children of its parent element.
Consider this selector: .table-middle:last-of-type
.
while .table-middle
points the element correctly, the element that has .table-middle
class is NOT the last sibling of its type
, because the term of type
refers to the HTML element itself, not combination of element.class
.
Here is the working solution:
HTML
<table cellpadding="0" cellspacing="0" style="width:752px;" class="table">
<thead>
<tr>
<th style="width:40px;">ID</th>
<th>Post title</th>
<th>Date</th>
<th>Owner</th>
<th style="width:100px;">Actions</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="5"></td>
</tr>
</tfoot>
<tbody>
<tr>
<td>1</td>
<td>Test</td>
<td>16.7.2013</td>
<td>Admin</td>
<td>Delete</td>
</tr>
<tr>
<td>2</td>
<td>Test 2</td>
<td>3.8.2013</td>
<td>Admin</td>
<td>Delete</td>
</tr>
</tbody>
</table>
CSS
.table tbody tr:last-child td {
border-bottom:none;
background:red;
}
Here is the Fiddle
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…