I have tried everything I can find online to modify this or that to make sticky table headers for my gtsummary table, to no avail. Using custom css to make sticky headers works just fine when I make tables using other packages, like arsenal. Is there a reason it doesn't work with gtsummary?
I created a simple gtsummary table in Rmarkdown, and wrote some css in a separate file which I called in the YAML header. I know the css is working in general because the very table header I'm trying to make stick has a box shadow just the way I've specified, but no stickiness.
This is my css code:
thead {
background: white;
position: sticky;
top: 0;
box-shadow: 0 8px 2px -1px rgba(0, 0, 0, 0.2);
}
Again, the box-shadow works fine, so I know it's identifying the right element. I've also gotten the box-shadow part to work by calling the th element instead of thead. But no matter what I do the header won't stick.
Thank you in advance for your help.