fix table headers


I have a table and i would like to fix the table header using javascript. Can anyone help with good script that is easy to use and works in all browsers?

Who is Participating?
BardobraveConnect With a Mentor Commented:
What do you mean by fix headers?

If you mean that you want to have table headers on a fixed position while table rows scroll up and down you don't need to use javascript, just create a table with the headers and other with the rows, each one included inside a <div>. Add row's div a overflow:auto css attribute et voilá.

Keep in mind that the apparition of the scrollbar would displace a bit your rows, so give your row's div a bit of extra space in anticipation.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.