gpt4 book ai didi

带有边框半径和粘性标题的 HTML 表格

转载 作者:行者123 更新时间:2023-12-05 01:06:57 27 4
gpt4 key购买 nike

我有一个 HTML <table>border-radius和使用 position: sticky 的粘性标题看起来像这样:

https://codepen.io/muhammadrehansaeed/pen/OJpeeKP

enter image description here

但是,当使用粘性标题滚动时,表格行会在粘性标题的圆 Angular 所在的位置突出。见这张图片的左上角:

table row borders displayed in area cut out by border radius of sticky header

有没有一种方法可以在使用粘性标题向下滚动时保持圆 Angular ,或者当标题变得粘性并从其原始位置向下移动时移除粘性标题?理想情况下,我想要一个 CSS only 解决方案。

最佳答案

您可以使用伪元素隐藏部分边框:

table thead th:first-child::before, 
table thead th:last-child::after {
width: 1px;
height: 5px;
background: white;
content: "";
display: block;
position: absolute;
top: 0px;
}
table thead th:first-child::before {
left: -1px;
}
table thead th:last-child::after {
right: -1px;
}

关于带有边框半径和粘性标题的 HTML 表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68119133/

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