特定のクラスのテーブルの偶数行を選択しようとしています。特定のCSSクラスの偶数行を選択する
ので、テーブルは次のようになります。
Absolute row 1 -- virtual row 1 of class a Absolute row 2 -- virtual row 2 of class a (should be matched by css selector) Absolute row 3 -- virtual *row 1* of class b Absolute row 4 -- virtual row 3 of class a Absolute row 5 -- virtual row 4 of class a (should be matched by css selector)
私はこのセレクタを使用してみました:
.table-result tbody tr.include:nth-child(even) {background-color: #eeeeee;}
が、それはまだある心
に別のクラスでのtrのを保持しますこれについてテーブルの中にテーブルを置く必要はありませんか?
HTML:
<table class="ui-widget ui-widget-content table-result" id="adspaceresult">
<thead>
<tr class="ui-widget-header">
<th>Type</th>
<th>Info</th>
<th>Average</th>
<th>Bid</th>
<th>Graph</th>
</tr>
</thead>
<tbody id="adrbody">
<tr class="include">
<td><button data-adtype="1" data-adspaceid="2" class="resultbutton ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button"><span class="ui-button-text">Micro Bar<br>
88x31</span></button></td>
<td></td>
<td>77</td>
<td>Bid</td>
<td>Graph</td>
</tr>
<tr>
<td colspan="5">Why hello there!</td>
</tr>
<tr class="include">
<td><button data-adtype="1" data-adspaceid="3" class="resultbutton ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button"><span class="ui-button-text">Micro Bar<br>
88x31</span></button></td>
<td></td>
<td>748102</td>
<td>Bid</td>
<td>Graph</td>
</tr>
<tr class="include">
<td><button data-adtype="1" data-adspaceid="5" class="resultbutton ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button"><span class="ui-button-text">Micro Bar<br>
88x31</span></button></td>
<td></td>
<td>226</td>
<td>Bid</td>
<td>Graph</td>
</tr>
<tr class="include">
<td><button data-adtype="1" data-adspaceid="6" class="resultbutton ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button"><span class="ui-button-text">Micro Bar<br>
88x31</span></button></td>
<td></td>
<td>6003</td>
<td>Bid</td>
<td>Graph</td>
</tr>
</tbody>
</table>
"なぜこんにちは" のメッセージがにカウントすべきではありません含むTR。あなたは、行の数が限られている場合
'child'と' of-type'セレクタはすべて同じように動作します。とにかく、あなたのHTMLを見る必要があります。 – BoltClock
テーブルが静的であるか、動的に書き出されていますか?後者の場合は、作成スクリプトにアクセスして別のクラスを追加できますか? – shanethehat
さて、htmlを追加しました。それは動的です。最初は偶数または不均等の行しか含まれていませんが、後で(uxの視点からの)行が実際に最上行に属します。 – skerit