背景颜色不适用于显示内容

Background Color not working with display contents

我正在尝试将 borderbackground-color 添加到我的 table 但它没有被应用。

CSS 我的 table :-

table {
  width: 100%;
  display: grid;
  overflow: auto;
}
    
table thead,
table tbody,
table tr {
  display: contents;
}

CSS 尝试应用但不起作用

tbody tr:nth-child(odd) { 
  border: solid 1px #e2e2e2;
  background-color: #f4f4f4;
}
tbody tr:nth-child(even) { 
  border: solid 1px #e2e2e2;
  background-color: blue;
}

请给我一个出路,因为我需要申请background-color。 我也试过申请。

tbody tr {
  background-color: blue;
}

这也不起作用。

提前致谢。

尝试 select td :

table {
  width: 100%;
  display: grid;
  overflow: auto;
}
tbody tr:nth-child(odd) > td{ 
  border: solid 1px #e2e2e2;
  background-color: #f4f4f4;
}
tbody tr:nth-child(even) > td{ 
  border: solid 1px #e2e2e2;
  background-color: blue;
}
table thead,
table tbody,
table tr {
  display: contents;
 }
<table>
  <thead>
    <tr>
      <th>header</th>
      <th>header</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>1st row</td>
      <td>1st row</td>
    </tr>
    <tr>
      <td>2nd row</td>
      <td>2nd row</td>
    </tr>
  </tbody>
</table>