不透明的白色背景,但保留边框 table

Non-transparent white background but keep borders on table

我几乎成功地使 table 的左栏变为粘性,这样其余的栏就可以滚动了。然而,这产生了一个新问题:table 背景是白色的,这意味着滚动的单元格在粘性单元格下方蒸发(见屏幕截图 1)。为了解决这个问题,我使用 background-color: rgba(255, 255, 255, 1.0); 使粘性单元格的背景不透明。但这也消除了粘性单元格的边界(参见屏幕截图 2)。两种变体都很丑。

我试过向粘性单元格添加 border:1px solid #cdcdcd;(甚至添加 !important),但边框仍然不可见。有什么建议吗?

这是应用于 table 的整个格式:

div#scrollable {
   overflow-x: scroll;
}
table#stats {
   border-collapse:collapse;
   width:100%;
}
table#stats th.sticky, td.sticky {
   position: -webkit-sticky; /* for Safari */
   position: sticky;
   left: 0;
}
table#stats td.sticky {
   background-color: rgba(255, 255, 255, 1.0);
   border:1px solid #cdcdcd !important;
}
table#stats tr#means {
   background-color:#ddffd5;
}
table#stats td.stats {
   border:1px solid #cdcdcd;
}

transparent sticky cells non-transparent sticky cells

除此之外我没有找到任何其他解决方案

th.sticky:after, td.sticky:after{
    content : "";
    position: absolute;
    bottom: 0;
    display: block;
    width: 100%;
    height: 1px;

    background-color: #cdcdcd;
}

编辑:这里有其他解决方案