I am trying to design an HTML table where the header will stay at the top of the page when AND ONLY when the user scrolls it out of view. For example, the table may be 500
I found a simple solution without using JQuery and using CSS only.
You have to put the fixed contents inside 'th' tags and add the CSS
table th {
position:sticky;
top:0;
z-index:1;
border-top:0;
background: #ededed;
}
The position, z-index and top properties are enough. But you can apply the rest to give for a better view.