2
In my HTML there are two separate tables, and in all my tags tr contain a hover applied in the CSS.
My question is the following: when passing the mouse on a tag tr of a table it is possible to apply the tr from the other table?
This is possible only with CSS or we need Javascript as well?
div {
  display: flex;
}
table{
  border-collapse: collapse;
  width: 100%;
  margin: 2px;
  text-align: center;
}
th{
  border: 1px solid black;
  background-color: gray;
}
td{
  border: 1px solid black;
}
tr:hover{
  background-color: yellow;
}
<div>
<table>
  <thead>
    <tr>
      <th>1</th>   
      <th>2</th>
      <th>3</th>
      <th>4</th>
    </tr>
  </thead>
  
  <tbody>
    <tr>
      <td>1</td>
      <td>2</td>
      <td>3</td>
      <td>4</td>
    </tr>
     <tr>
      <td>1</td>
      <td>2</td>
      <td>3</td>
      <td>4</td>
    </tr>
     <tr>
      <td>1</td>
      <td>2</td>
      <td>3</td>
      <td>4</td>
    </tr>
  </tbody>
</table>
<table>
  <thead>
    <tr>
      <th>1</th>   
      <th>2</th>
      <th>3</th>
      <th>4</th>
    </tr>
  </thead>
  
  <tbody>
    <tr>
      <td>1</td>
      <td>2</td>
      <td>3</td>
      <td>4</td>
    </tr>
     <tr>
      <td>1</td>
      <td>2</td>
      <td>3</td>
      <td>4</td>
    </tr>
     <tr>
      <td>1</td>
      <td>2</td>
      <td>3</td>
      <td>4</td>
    </tr>
  </tbody>
</table>
</div>
Why don’t you just use one table?
– vinibrsl
is for a project, has to be separate tables. Are different segments tables.
– OtavioCapel