I've seen variations of this problem everywhere but none seem to solve my problem. I have a tall page that already has a Y scrollbar due to content. Part of the content is a div style="position: relative;", let's call it Div1. Div1 has content in it causing an X and Y scrollbar. In Div1 let's say I have a table with so many columns that it's causing the X overflow and so many rows that it's causing the Y overflow of Div1.
Is there any way to make the tables header row stick to the top of and maintain it's width in Div1?
Imagine the structure like so:
<div id="MainPageDiv">
//OnScreenContent
//OnScreenContent
//OnScreenContent
//OnScreenContent
<div class=outerDiv>
<table class="innerTable">
<thead>
//thead columns
</thead>
<tbody>
//tbody rows
</tbody>
</table>
</div>
//OnScreenContent
//OnScreenContent
//OnScreenContent
//OFFScreenContent
//OFFScreenContent
//OFFScreenContent
</div>
So the outerDiv and table sit a little ways down from the top of the page. Also note there is OFFscreenContent farther down.
I want the main page to scroll like normal, but within the outerDiv section I want the thead to stay at the top of the outerDiv container when I scroll in outerDiv.