In css, table tr: nth-child (even) changes tr background color: IE7, 8 is invalid, nth-childtr

Source: Internet
Author: User

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

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.