Initially scrolling, then fixed table header with scrolling page body.
I would like to put a table somewhere in the middle of my web page that has the following behavior:
- Acts like a "normal" html table for the most part... until you scroll past the table's headers
- When you scroll past the table's headers, the table headers stays fixed at or near the top of that page, while the rest of the table keeps scrolling with the rest of the page body. This is not the same as a scrolling
<tbody>
with fixed<thead>
. - Bonus points if the table headers disappear if you scroll past the last row of the table.
- Bonus points if the table rows disappear as they scroll higher than the headers. (I only need this feature when/if I were to try to place the fixed table header in a different location than at the very top of the page)
It should look something similar to the example given in this fiddle:
http://jsfiddle.net/yeAhU/260/
Except header contents would scroll to the top of the page before becoming fixed and the table contents should not show above the headers as it scrolls.
I have tried slightly tweaking most of the posted answers for "fixed table header scrolling body" questions online but I am not able to get the type of behavior I am looking for from those examples.
I would like the solution to be CSS-based if possible but I am open to other solutions like JS.
I would like the solution to be compatible with both Chrome & Firefox.
QUESTION
Is it possible to do this, and is it possible to do it in just CSS? How?