I used a derivation of ThinkingStiff's answer to this question cols, colgroups and css :hover psuedoclass to create a table that outlines columns and highlights rows on hover. (Vertical column headers intentionally not outlined).
See below:
table {
overflow: hidden;
}
caption {
background-color: #fff;
padding: 0px
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
text-align: center;
width: 100%
}
th, td {
width: 100px;
height: 50px;
position: relative;
}
tr:hover {
background-color: #FBFEFD;
}
td:hover::after {
content: "";
position: absolute;
outline: solid black 2px !important;
left: 0;
top: -5000px;
height: 10000px;
width: 100%;
z-index: -1;
}
<table class="ComparisonTable">
<caption>Comparison Table</caption>
<tbody>
<tr>
<th class="CompTabProdCat">Category</th>
<td>ProdCat1</td>
<td>ProdCat2</td>
<td>ProdCat3</td>
<td>ProdCat4</td>
<td>ProdCat5</td>
</tr>
<tr>
<th class="CompTabProdName">ProdName</th>
<td>ProdName1</td>
<td>ProdName2</td>
<td>ProdName3</td>
<td>ProdName4</td>
<td>ProdName5</td>
</tr>
<tr>
<th class="CompTabProdRat">Rating</th>
<td>ProdRating1</td>
<td>ProdRating2</td>
<td>ProdRating3</td>
<td>ProdRating4</td>
<td>ProdRating5</td>
</tr>
<tr>
<th class="CompTabProdPho">Photo</th>
<td>ProdImage1</td>
<td>ProdImage2</td>
<td>ProdImage3</td>
<td>ProdImage4</td>
<td>ProdImage5</td>
</tr>
<tr>
<th class="CompTabProdSum">Summary</th>
<td>ProdSum1</td>
<td>ProdSum2</td>
<td>ProdSum3</td>
<td>ProdSum4</td>
<td>ProdSum5</td>
</tr>
</tbody>
</table>
Does anyone know why the column outline disappears for the selected row? I thought the !important tag would maintain that outline, but apparently not. Any other workarounds available to maintain that outline?
Bonus question is why I'm losing the rightmost border (less stuck and less concerned with that question).
Thanks a ton; I appreciate it!