我有下表
<table>
<tr>
<td>1st</td>
<td>Anne Wright & Steve Wright</td>
<td>510 VPs</td>
</tr>
<tr>
<td>2nd</td>
<td>Ian Bruce & Lyn Hilton</td>
<td>472 VPs</td>
</tr>
<tr>
<td>3rd</td>
<td>Anne Morris & Lucy Pathan</td>
<td>469 VPs</td>
</tr>
<tr>
<td>4th</td>
<td>Mike Ayers & Mike Gould</td>
<td>426 VPs</td>
</tr>
<tr>
<td>5th</td>
<td>Alison Nichols & Simon Stokes</td>
<td>409 VPs</td>
</tr>
<tr>
<td>6th</td>
<td>Brian Stockdale & Sheila Stockdale</td>
<td>406 VPs</td>
</tr>
<tr class="relegated">
<td>7th</td>
<td>Pauline Dignan & Val Rees</td>
<td>349 VPs</td>
</tr>
<tr class="relegated">
<td>8th</td>
<td>Alan Lord & John Thompson</td>
<td>319 VPs</td>
</tr>
</table>
我想在包含類& quot降級& quot。
我知道我需要在孩子身上應用邊框& lttd & gt標簽,而不是& lttr & gt
我試過了
.relegated:nth-child(1) td {
border-top: 1px dashed red;
}
但是我什么也沒得到。做
tr:nth-child(7) td {
border-top: 1px dashed red;
}
確實有效。但我想以班級為基礎(因為這是一個聯賽表,你不能從底部分區降級)。
# # #用那個。 :第n個子級(類名的1個)
tr:nth-child(1 of .relegated) td{
border-top: 1px dashed red;
}
<table id="table">
<tbody>
<tr>
<td>1st</td>
<td>Anne Wright & Steve Wright</td>
<td>510 VPs</td>
</tr>
<tr>
<td>2nd</td>
<td>Ian Bruce & Lyn Hilton</td>
<td>472 VPs</td>
</tr>
<tr>
<td>3rd</td>
<td>Anne Morris & Lucy Pathan</td>
<td>469 VPs</td>
</tr>
<tr>
<td>4th</td>
<td>Mike Ayers & Mike Gould</td>
<td>426 VPs</td>
</tr>
<tr>
<td>5th</td>
<td>Alison Nichols & Simon Stokes</td>
<td>409 VPs</td>
</tr>
<tr>
<td>6th</td>
<td>Brian Stockdale & Sheila Stockdale</td>
<td>406 VPs</td>
</tr>
<tr class="relegated">
<td>7th</td>
<td>Pauline Dignan & Val Rees</td>
<td>349 VPs</td>
</tr>
<tr class="relegated">
<td>8th</td>
<td>Alan Lord & John Thompson</td>
<td>319 VPs</td>
</tr>
</tbody>
</table>