Table With Vertical Scroll Bar But Header Remains Fix.

Hi,

is it possible to have a vertical scroll bar which preferably doesn’t affect the table header.

pls help .

thanks

set display:block property to thead, tbody.

You can use below script to make it work.




<style>

tbody {

    height: 50px;

    overflow: auto;

}

thead, tbody{

    display:block;

}

</style>

<table>

    <thead>

    <tr>

        <th>Heading1</th>

        <th>Heading2</th>

        <th>Heading3</th>

        <th>Heading4</th>

    </tr>

    </thead>

    <tbody>

    <tr>

        <td>text1</td>

        <td>text1</td>

        <td>text1</td>

        <td>text1</td>

    </tr>

    <tr>

        <td>text2</td>

        <td>text2</td>

        <td>text2</td>

        <td>text2</td>

    </tr>

     <tr>

        <td>text3</td>

        <td>text3</td>

        <td>text3</td>

        <td>text3</td>

    </tr>

    </tbody>

</table>



Hi, Absar A Hasan

Thank you so much.it works…

Thanks…

Regards,

janvi