How to use nth-child for styling with a table with rowspan?

后端 未结 6 1967
盖世英雄少女心
盖世英雄少女心 2020-12-01 17:37

I have a table that has one row that uses rowspan. So,

6条回答
  •  一整个雨季
    2020-12-01 18:22

    Try to separate table by tbody, something like:

    tbody tr:nth-child(odd){
      background: #00FFFF;
    }
    tbody tr:nth-child(even){
      background: #FF0000;
    }
    
    tbody:nth-child(odd)  td[rowspan]{
      background: #00FFFF;
    }
    tbody:nth-child(even)  td[rowspan]{
      background: #FF0000;
    }  
.........
... ... ... ... ...
... ... ...
... ... ...
... ... ...
... ... ... ... ...
... ... ...
... ... ...

提交回复
热议问题