I'd like to use the tr:nth-child(even/odd) pseudo class for a table, but I want to support the IE 2 population as well. So, is there any purely css way to add a border to tr if nth-child isn't supported?
You can try Selectivizr, I think that's the easiest solution.
EDIT:
You could also use jquery to add classes for you:
$(function() {
$("tr:odd").addClass("odd");
$("tr:even").addClass("even");
});
EDIT2:
Also, if you're using Modernizr, you could try this.
EDIT3 :)
tr { border-bottom: 1px solid #ccc; }
tr:nth-child(odd),
tr:nth-child(even) { border: none; }
tr:nth-child(odd) { background: #eee; }
tr:nth-child(even) { background: #ddd; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With