Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get odd/even coloring for IE and Firefox using CSS alone?

I use php for my web project, but I need this coloring complement with CSS alone.

Thus I need code that works in Firefox and internet explorer.

This code is written, but does not work in internet explorer:

.tbl_css col:nth-child(odd){      
}

.tbl_css col:nth-child(even){    
}
like image 478
aya Avatar asked Sep 19 '11 12:09

aya


1 Answers

Lower versions of IE will not support pseudo-selection.

You can use jQuery to make it work:

$(document).ready(function(){
    $('table tr:even').addClass('even');
    $('table tr:odd').addClass('odd');
});

In CSS simply:

.even{ /* your styles */ }
.odd { /* your styles */ }
like image 119
sankar.suda Avatar answered Nov 15 '22 08:11

sankar.suda