I don\'t know why my border style do not work with position: sticky;
attribute. I would like to set border styles on my sticky table header. But I don\'t want t
This is, I believe the simplest answer.
The accepted answer don't provide a solution for a 1px border.
Note: this is a work around, so don't gripe me.
If you remove the border-top
from the table header, the table has nothing to collapse, so no space is created to see through to the underlying cells. Replace the border-top
with a border of the same style in a holding DIV.
css:
table thead tr:nth-child(1) th {
position: sticky;
border-top:0;
}
.table_holder {
border-top:1px solid black;
}
html:
...