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
How about replacing border
with outline
? I dare to say that especially for table elements the outline
acts almost the same as border
. I know it is not out of the box model etc. but visually is identical here. Try this:
table tr th,
table tr td {
border: 0;
outline: 2px solid;
}
Bear in mind, outline
is always rendered around the whole element, there is nothing like outline-left
, so it is not silver bullet. See outline on MDN for further details.
UPDATE: Well I overlooked one detail, the outline is not properly aligned with tbody
borders. You have to eiter swap border
and outline
for the whole table or use transform
and nudge the thead
, but perhaps it is not good way to go (it depends, of course).