gpt4 book ai didi

表格行上的 CSS 框阴影显示不正确

转载 作者:太空宇宙 更新时间:2023-11-04 06:26:33 24 4
gpt4 key购买 nike

当悬停在表格行上时,我在表格行上添加了一个轻微的框阴影,这样它会更明显一些。它可以正常工作,但当我添加交替行颜色时,它会停止正确显示。

Here is a JSFiddle of the problem.

<div class="search-table">
<table>
<tbody>
<tr>
<td>A1</td>
<td>A2</td>
</tr>
<tr class="alt">
<td>B1</td>
<td>B2</td>
</tr>
<tr>
<td>C1</td>
<td>C2</td>
</tr>
<tr class="alt">
<td>C1</td>
<td>C2</td>
</tr>
</tbody>
</table>
</div>
<style>
.search-table {
display: block;
background-color: #535353;
font: normal 12px/150% Arial, Helvetica, sans-serif;
overflow: hidden;
border: 1px solid #8C8C8C;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}

.search-table a {
color: #424242;
}

.search-table table {
border-collapse: collapse;
text-align: left;
width: 100%;
background-color: #ffffff;
}

.search-table table td, .search-table table th {
padding: 3px 10px;
}

.search-table table thead th {
background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #8C8C8C), color-stop(1, #7D7D7D) );
background: -moz-linear-gradient( center top, #8C8C8C 5%, #7D7D7D 100% );
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#8C8C8C', endColorstr='#7D7D7D');
background-color: #8C8C8C;
color: #FFFFFF;
font-size: 15px;
font-weight: bold;
border-left: 1px solid #A3A3A3;
}

.search-table table thead th:first-child {
border: none;
}

.search-table table tbody td {
color: #424242;
border-left: 1px solid #DBDBDB;
font-size: 1.25em;
font-weight: normal;
padding: 0.5em;
}

.search-table table tbody tr {
z-index: 0;
}

.search-table table tbody tr:hover {
box-shadow: 0px 0px 3px 0px #00000082;
z-index: 1;
}

.search-table table tbody tr.alt {
background: #EBEBEB;
color: #424242;
}

.search-table table tbody td:first-child {
border-left: none;
}

.search-table table tbody tr:last-child td {
border-bottom: none;
}
</style>

如您所见,当鼠标悬停在具有“alt”类的较深颜色的行上方时,框阴影会正常显示,但对于较浅颜色的行,它只会在行的顶部显示阴影,而不会在上方显示底端。从第 2 行和第 4 行删除“alt”类修复它,但以交替行颜色为代价。是什么导致了这种行为的发生,我该如何解决?

最佳答案

您可以通过将 transform: scale(1) 应用于悬停行来解决框阴影被其他表格行“隐藏”的问题:

.search-table table tbody tr:hover {
box-shadow: 0px 0px 3px 0px #00000082;
transform: scale(1);
}

关于表格行上的 CSS 框阴影显示不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55046056/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com