Wednesday, March 19, 2008

Scrollable table

We can add scrollbars to an html table by simply adding the below line of code to the table

<div style="border:1px solid; width:300px; height:400px; overflow:auto;">

Example

<div style="border:1px solid; width:300px; height:400px; overflow:auto;">
‎<table>
<tr>
<td>Data 1</td>
</tr>
<tr>
<td>Data 2</td>
</tr>
<tr>
<td>Data 3</td>
</tr>
</table>
</div>

The "height" attribute is very important in order for scrollbars to appear

No comments: