我使用了ThinkingStiff对这个问题cols, colgroups and css :hover psuedoclass的答案的一个派生来创建一个表格,该表格列出了悬停时的列和突出显示的行。 (有意不列出垂直列标题)。按行高亮重叠列轮廓? (html表格,css格式)
见下文:
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">
\t <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>
有谁知道为什么选定行的列轮廓消失?我认为!重要的标签会保持这个轮廓,但显然不是。任何其他解决方法可用于维护该大纲?
奖金的问题是为什么我失去了最右边的边界(少卡住,不太关心这个问题)。
感谢一吨;我很感激!
为什么你在你的表格单元上使用相对位置? –
简短的回答是因为这样做可以使轮廓起作用(减去行高亮)。当我删除位置相对线时,轮廓完全停止工作。为什么是这种情况..我不知道。我对此很感兴趣。 – admsdro