0

I need to style the last row in each group (that is Row 3, Row 5 and Row 8). My css sample only apply style to Row 8.

Code:

tr.row:last-child td {
  background-color: red;
}
<table>
  <tr class="group">
    <td>Group 1</td>
  </tr>
  <tr class="row">
    <td>Row 1</td>
  </tr>
  <tr class="row">
    <td>Row 2</td>
  </tr>
  <tr class="row">
    <td>Row 3</td>
  </tr>
  <tr class="group">
    <td>Group 2</td>
  </tr>
  <tr class="row">
    <td>Row 4</td>
  </tr>
  <tr class="row">
    <td>Row 5</td>
  </tr>
  <tr class="group">
    <td>Group 3</td>
  </tr>
  <tr class="row">
    <td>Row 6</td>
  </tr>
  <tr class="row">
    <td>Row 7</td>
  </tr>
  <tr class="row">
    <td>Row 8</td>
  </tr>
</table>
Daweed
  • 1,419
  • 1
  • 9
  • 24
MojoDK
  • 4,410
  • 10
  • 42
  • 80

0 Answers0