This is called a fixed scrolling header. There are a number of documented approaches:
http://www.imaputz.com/cssStuff/bigFourVersion.html
You wonโt be able to handle this effectively without JavaScript ... especially if you want cross-browser support.
There are a number of issues with any approach you use, especially regarding cross-browser / version support.
Edit:
Even if this is not the header you want to fix, but the first row of data, the concept remains the same. I was not 100% what you had in mind.
Another thought that my company was tasked with finding a solution for this that could work in IE7 +, Firefox, and Chrome.
After many moons of searching, trying and disappointment, it really came down to a fundamental problem. For the most part, to get a fixed header, you need to implement fixed height / width columns, because most solutions use two separate tables, one for the header, which will float and stay in place above the second table containing the data.,
//float this one right over second table <table> <tr> <th>Header 1</th> <th>Header 2</th> </tr> </table> <table> //Data </table>
Alternatively, you can use some tbody and thead tags, but this is also a drawback, because IE will not allow you to put the scroll bar on tbody, which means you cannot limit its height (silly IMO).
<table> <thead style="do some stuff to fix its position"> <tr> <th>Header 1</th> <th>Header 2</th> </tr> </thead> <tbody style="No scrolling allowed here!"> Data here </tbody> </table>
This approach has many problems, such as ensuring EXACT pixel width, because the tables are so cute that different browsers will distribute pixels differently based on calculations, and you just CANNOT guarantee (AFAIK) that the distribution will be perfect in all cases. This becomes obviously obvious if you have borders inside the table.
I took a different approach and said that the screw tables, since you can not give this guarantee. I used a div to simulate tables. This also has problems with the positioning of rows and columns (mainly due to floating point problems, using the inline block will not work in IE7, so I really had to use absolute positioning to put them in their place).
There is someone who created the Slick Grid, which is very similar to mine, and you can use a good (albeit complex) example to achieve this.
https://github.com/6pac/SlickGrid/wiki