Wednesday, 23 October 2013

Add horizontal scrollbar to html table

Inorder to add a horizontal scroll bar on html table automatically as the table grows, we need to wrap the table inside a div and add overflow:auto css property

For eg:

<div style="white-space:pre;overflow:auto;width:500px;padding:10px;"> <table style="width:900px;"> <tr> <td>text1</td> <td>text2</td> <td>text3</td> </tr> </table> </div>