is there a version of css3 code below that will work in all browers?
table tr:nth-child(odd) { background-color: #ccc; }
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No.
You have at least two options, though:
Manually apply a style to the odd (and/or) even rows and then style those appropriately:
tr.odd {background-color: #ccc; }Use JS (I’d suggest jQuery):
$('tr:nth-child(odd)').css('background-color','#ccc');or$('tr:nth-child(odd)').addClass('odd')(either of these would need to be in a$(document).ready();(or equivalent) though, obviously).