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

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

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

6条回答
  •  遥遥无期
    2020-12-01 18:22

    I had a similar issue and I just overrode the row background with backgrounds on the TD's inside of them. Depending on your desired outcome, this may work for you too?

    tr:nth-child(odd) {
        background: #DDE;
    }
    tr:nth-child(odd) td[rowspan] {
        background: #FFF;
    }
    

    Of course you can override other rows like headers, etc with a class or th.

提交回复
热议问题
.........