Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
テーブルの最初の列にゼブラ効果を加えたいと思います。tr の最初の td を選択して nth-child(2n) を適用するにはどうすればよいですか?
:nth-child()疑似クラスは に、tr疑似クラス:first-childは に移動しtdます。
:nth-child()
tr
:first-child
td
$('tr:nth-child(2n) td:first-child').css('background-color', '#ccc');
nth-child(2n)に追加してから、最初の のみを選択するために<tr>使用する必要があります。ここでチェックしてください::first-child<td>
nth-child(2n)
<tr>
<td>
http://jsfiddle.net/ajthomascouk/WtLek/