我在我的HTML文件中有這樣的代碼。我需要針對第<tr>
級detail-row
和<tr>
我需要針對.k-grouping-row
類爲<tr>
。CSS需要指定一個類的第2行
我該如何使用CSS來定位?我試過nth-child
,但它不適用於類名。
<table>
<tr class="master-row" ></tr>
<tr class="detail-row" ></tr>
<tr class="master-row" ></tr>
<tr class="detail-row" >
<td class="k-detail-cell" colspan="5">
<div class="k-grid k-widget">
<div class="k-grid-header" >
<div class="k-grid-header-wrap >
<table role="grid">
<thead role="rowgroup">
<tr role="row">
<th class="k-group-cell k-header" scope="col"> </th>
</tr>
</thead>
</table>
</div>
</div>
<div class="k-grid-content k-auto-scrollable" style="height: 0px;">
<table role="grid">
<tbody role="rowgroup">
<tr role="row" class="k-grouping-row"></tr>
</tbody>
</table>
</div>
</div>
</td>
</tr>
</table>
請先修復元素標籤。 – bpunzalan
您的行中沒有任何單元格 - 這是無效的HTML。 – Johannes
通過在css中調用其類名稱來達到目標:'.k-grouping-row {background-color:black; }' – terryeah