0

I have td's which is colorized with background, but i want to get their row parent and set same colour. Also to have hover effect again on their parent row with different colour. So ... how to get parent row ?

enter image description here

And can i do all this with inline css ? JS is also allowed. Without jquery.

MorganFreeFarm
  • 3,811
  • 8
  • 23
  • 46

1 Answers1

1

You may try for this:

.hoverTable {
  width: 100%;
  border-collapse: collapse;
}

.hoverTable td {
  padding: 7px;
  border: #4e95f4 1px solid;
}


/* Define the default color for all the table rows */

.hoverTable tr {
  background: red;
}


/* Define the hover highlight color for the table row */

.hoverTable tr:hover {
  background-color: skyblue;
}
<table class="hoverTable">
  <tr>
    <td>Text 1A</td>
    <td>Text 1B</td>
    <td>Text 1C</td>
  </tr>
  <tr>
    <td>Text 2A</td>
    <td>Text 2B</td>
    <td>Text 2C</td>
  </tr>
  <tr>
    <td>Text 3A</td>
    <td>Text 3B</td>
    <td>Text 3C</td>
  </tr>
</table>
mplungjan
  • 169,008
  • 28
  • 173
  • 236
Kunvar Singh
  • 1,779
  • 2
  • 13
  • 21