Reputation:
I have simple html table on which I want to remove bottom border of tr
on specific row.
The table
<table cellpadding="5">
<thead>
<tr valign="top">
<th>Title</th>
<th>Title 2</th>
<th>Title 3</th>
<th>Title 4</th>
</tr>
</thead>
<tbody>
<tr>
<td>Test Entry</td>
<td>Test Entry</td>
<td>Test Entry</td>
<td>Test Entry</td>
</tr>
<tr class="no-bottom-border">
<td>Test Entry</td>
<td>Test Entry</td>
<td>Test Entry</td>
<td>Test Entry</td>
</tr>
<tr>
<td>Test Entry</td>
<td>Test Entry</td>
<td>Test Entry</td>
<td>Test Entry</td>
</tr>
</tbody>
</table>
What I've tried is to add class to the tr
which I want to be without bottom border class="no-bottom-border"
and with css to remove it
tr .no-bottom-border {border-bottom: none}
This doesn't seems to work. Here is the JSFIDDLE with the table
Upvotes: 9
Views: 28746
Reputation: 1417
I copied your code and tried to change it.You just have to remove the border of all td inside .no-bottom-border tr, instead of removing the border of tr.
.no-bottom-border td {
border-bottom: none;
}
Upvotes: 5
Reputation: 43870
Target the borders of td
, because tr
has no border properties.
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
}
table {
border: 1px solid #ccc;
color: #37393b;
margin: 10px 0 0 0;
text-shadow: #fff 1px -1px 1px;
text-align: left;
width: 100%;
}
table tbody tr td {
background: #FFF;
border-bottom: 1px dotted #d00;
}
tr.no-bottom-border td {
border-bottom: none
}
<table cellpadding="5">
<thead>
<tr valign="top">
<th>Title</th>
<th>Title 2</th>
<th>Title 3</th>
<th>Title 4</th>
</tr>
</thead>
<tbody>
<tr>
<td>Test Entry</td>
<td>Test Entry</td>
<td>Test Entry</td>
<td>Test Entry</td>
</tr>
<tr>
<td>Test Entry</td>
<td>Test Entry</td>
<td>Test Entry</td>
<td>Test Entry</td>
</tr>
<tr class="no-bottom-border">
<td>Test Entry</td>
<td>Test Entry</td>
<td>Test Entry</td>
<td>Test Entry</td>
</tr>
<tr>
<td>Test Entry</td>
<td>Test Entry</td>
<td>Test Entry</td>
<td>Test Entry</td>
</tr>
</tbody>
</table>
Upvotes: 6