I need to put a scrollable div in a table cell. The table should be 100% high. The div has a lot of content that doesn't fit on the screen, so scroll should be displayed. But I only want to scroll through the div , not the entire page.
If I do not use a table, everything is perfect:
<div style="height: 100%; width: 100px; padding: 5px; overflow: auto; border-width: 1px; border-style: solid;">
<div>
Item 1<br/>
Item 2<br/>
...
Item 300<br/>
</div>
</div>
The div scrolls, the page does not have a scroll bar. But if it is wrapped in a table:
<table style="height: 100%">
<tr>
<td>
<div style="height: 100%; width: 100px; padding: 5px; overflow: auto; border-width: 1px;
border-style: solid;">
<div>
Item 1<br/>
Item 2<br/>
...
Item 300<br/>
</div>
</div>
</td>
</tr>
</table>
the page becomes scrollable, and the div ceases to be one. What can I do?
source
share