css为tbody或者li奇数偶数行样式

<style>
  table tbody tr:nth-child(odd){
    background:#fff;
  }
  table tbody tr:nth-child(even){
    background:#F5F5F5;
  }
</style

<table>
  <thead>
    <th>序号</th>
    <th>姓名</th>
    <th>性别</th>
  </thead>

  <tbody>
    <tr>
      <td>1</td>
      <td>张三</td>
      <td>男</td>
    </tr>

    <tr>
      <td>1</td>
      <td>李四</td>
      <td>男</td>
    </tr>
  </tbody>
</table

 

posted @ 2017-07-21 15:21  亦心晗  阅读(726)  评论(0编辑  收藏  举报