Learn how to highlight cells on hover based on their row and column.
<html>
<style>
table {
border-spacing: 0;
border-collapse: collapse;
overflow: hidden;
background-color: white;
}
td, th {
padding: 10px;
position: relative;
}
tr:hover{
background-color: rgba(255, 255, 0, 0.5);
}
td:hover::after,th:hover::after {
background-color: rgba(255, 255, 0, 0.5);
content: '\00a0';
height: 10000px;
left: 0;
position: absolute;
top: -5000px;
width: 100%;
}
</style>
<body>
<table>
<tr>
<th></th>
<th>lore</th>
<th>lore</th>
<th>lore</th>
<th>lore</th>
<th>lore</th>
</tr>
<tr>
<th class="row">lore</th>
<td>20</td>
<td>21</td>
<td>23</td>
<td>25</td>
<td>27</td>
</tr>
<tr>
<th class="row">lore</th>
<td>18</td>
<td>20</td>
<td>22</td>
<td>24</td>
<td>26</td>
</tr>
<tr>
<th class="row">lore</th>
<td>17</td>
<td>19</td>
<td>21</td>
<td>23</td>
<td>25</td>
</tr>
<tr>
<th class="row">lore</th>
<td>16</td>
<td>18</td>
<td>20</td>
<td>22</td>
<td>24</td>
</tr>
</table>
</body>
</html>
<!DOCTYPE html>
<html>
<style>
table {
border-spacing: 0;
border-collapse: collapse;
overflow: hidden;
background-color: white;
}
td, th {
padding: 10px;
position: relative;
}
tr:hover{
background-color: rgba(255, 255, 0, 0.5);
}
td:hover::after,th:hover::after {
background-color: rgba(255, 255, 0, 0.5);
content: '\00a0';
height: 10000px;
left: 0;
position: absolute;
top: -5000px;
width: 100%;
}
</style>
<body>
<table>
<tr>
<th></th>
<th>lore</th>
<th>lore</th>
<th>lore</th>
<th>lore</th>
<th>lore</th>
</tr>
<tr>
<th class="row">lore</th>
<td>20</td>
<td>21</td>
<td>23</td>
<td>25</td>
<td>27</td>
</tr>
<tr>
<th class="row">lore</th>
<td>18</td>
<td>20</td>
<td>22</td>
<td>24</td>
<td>26</td>
</tr>
<tr>
<th class="row">lore</th>
<td>17</td>
<td>19</td>
<td>21</td>
<td>23</td>
<td>25</td>
</tr>
<tr>
<th class="row">lore</th>
<td>16</td>
<td>18</td>
<td>20</td>
<td>22</td>
<td>24</td>
</tr>
</table>
</body>
</html>