0

I'd like to make the zebra effect on the first column of a table. How could I could select the first td of a tr and apply nth-child(2n) on it?

2 Answers 2

2

The :nth-child() pseudo-class goes to the tr, and the :first-child pseudo-class to the td:

$('tr:nth-child(2n) td:first-child').css('background-color', '#ccc');
Sign up to request clarification or add additional context in comments.

Comments

0

You need to add nth-child(2n) to the <tr> and then use :first-child to only select the first <td>. Check it out here:

http://jsfiddle.net/ajthomascouk/WtLek/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.