I am currently working on implementing frozen row and column headers in a table within a content wrapper, similar to what you see in Excel. However, I have been facing challenges with using CSS tricks that involve the position:absolute property, especially when there are other shifting elements on the screen.
My goal is to have the row and column headers (represented by the red, green, and purple boxes) stay fixed in place while the user scrolls or pans through the white region of the table. The gray area surrounding the content cannot be removed.
It is likely that the content will stretch vertically beyond the initial view, so ideally, I would like the column headers to stick to the top as the user scrolls down. However, it is not a mandatory requirement for me. Even if the headers just remain in their original position when the page is loaded, I would appreciate it.
In addition, I want the row headers to remain static while scrolling horizontally causes the column headers to move along with the content.
If there is a reliable way to achieve this functionality, I would greatly appreciate any guidance. I have created a JSFiddle to demonstrate the scenario within the content wrapper: http://jsfiddle.net/Jr5Zt/3/
<table id="bodyTable">
<tbody><tr><td id="bodyCell">
<!-- my custom content -->
</td></tr></tbody>
</table>