Pravin Vavadiya Pravin Vavadiya - 20 days ago 6
CSS Question

Add css in HTML table?

I want to add

backbround-color
on third
tr
in
table
using css not inline style.

Any one help me?

Below my html code:

<table>
<tr>
<td>First TR</td>
</tr>
<tr>
<td>Second TR</td>
</tr>
<tr>
<td>Third TR</td>
</tr>
<tr>
<td>Four TR</td>
</tr>
<tr>
<td>Fifth TR</td>
</tr>
</table>


Thanks

GvM GvM
Answer

table>tbody>tr:nth-child(3) {
background-color:red;
}
<table>
  <tr>
    <td>First TR</td>
  </tr>
  <tr>
    <td>Second TR</td>
  </tr>
  <tr>
    <td>Third TR</td>
  </tr>
  <tr>
    <td>Four TR</td>
  </tr>
  <tr>
    <td>Fifth TR</td>
  </tr>
</table>