How to fix the heading in html table using css

Tags: html,css,html5,dom

Problem :

I am creating an HTML file I am creating a table in it . I want that header of the table should be fixed and scrolling should work for the rest of the table not for the headings. I am using the following code for this. Suggest me the best alternative for this.

<!DOCTYPE html>
<style type="text/css">



    <div class="underDiv">
     <th>Roll no</th>
     <th> Name</th>
    <div class="overflowDiv">

Solution :

There are handy jQuery solutions for this, check out Waypoints > Sticky:

    CSS Howto..

    How to override the height of parent node using CSS?

    How can I make the left div expand and the right div have constant width?

    How to debug HTML/CSS for iPhone/iPad performance?

    How to stop these two divs/navbars from overlapping in Bootstrap

    Android How to load Custom CSS on external HTML page in WebView

    How to make Firefox button respect padding?

    How to fix position of html element label with css?

    How to disable temporary cursor with javascript?

    How can I use jQuery (or CSS) to sort HTML tables by column?

    How to apply local styles / JS to UIWebview after loading a URL

    How to Customize jCountdown timer which is using css sprite resources to become auto Responsive?

    How to define exceptions for the Third occurence of a DIV?

    why image show space and go right, it should be fill up the gap

    How to prevent PHP pushed HTML tables exceeding the length of the page

    CSS: how to move element from one column to another one without changing the html?

    How to get the first parent that has a certain CSS property using jQuery?

    How to set link visited color in JQuery

    How do I get my body to the bottom of my page OR further if necessary?

    How to create a border with spaces in it [duplicate]

    How put a top border to a title that only cover the letters in css

    How do you find the largest font size that won't break a given text?

    How can I stop divs getting pushed down?

    How to minify HTML with CSS and Javascript? [closed]

    How do I add a CSS class to a BoundField, so I can find it with jQuery?

    How do I make two arrows in css

    CSS - How to make different background color from css file used [closed]

    How can I allow resizable() to increase size beyond initial size?

    How to get css div to stretch to 100% of window

    How do display a CMS collection in an page using an XSLT file

    How can I turn a background visibility on and off with jQuery?