In css, table tr: nth-child (even) changes tr background color: IE7, 8 is invalid, nth-childtr
For example:
. My_table tr: nth-child (even) {background: # E6EDF5;}. my_table tr: nth-child (odd) {background: # F0F5FA ;}
IE7, 8 is invalid and cannot be identified.
Another method:Add class to tr to be discolored
. Table_border table tr. even {background: # f8f8fb ;}
Method 3: jquery implementation
$ (". Nav ul li div a: nth-child (even) "mirror.css ({'background': 'red'}); $ (". nav ul li div a: nth-child (odd) ").css ({'background': 'Gray '});
There are still four ways to view it on the Internet:
Tr {background-color: expression (this. sectionRowIndex % 2 = 0 )? "Red": "blue")} td {background-color: expression (this. cellIndex % 2 = 0 )? "" :( (This. parentElement. sectionRowIndex % 2 = 0 )? "Green": "yellow "))}
However, in practice, we found that the fourth method was completely unresponsive. If your practice is effective, let's talk about the reasons.
Method 4 reference address:
Http://www.cnblogs.com/xiaofengfeng/archive/2011/01/18/1938453.html