Alternate table row color using CSS?

后端 未结 9 1770
囚心锁ツ
囚心锁ツ 2020-11-22 09:03

I am using a table with alternate row color with this.

9条回答
  •  逝去的感伤
    2020-11-22 09:35

    can i write my html like this with use css ?

    Yes you can but then you will have to use the :nth-child() pseudo selector (which has limited support though):

    table.alternate_color tr:nth-child(odd) td{
       /* styles here */
    }
    table.alternate_color tr:nth-child(even) td{
       /* styles here */
    }
    

提交回复
热议问题