David Alwis
David Alwis

Reputation: 125

Set div height auto and scroll can be used

<div style='width: 240px; height:530px; overflow:scroll;'>
<table>
bla.. bla..
</table>
</div>

Dear all, I want to set this div height automatically, but when I change this into height:auto; the data in table cannot be scroll.

Anyone have a suggestions ?

Thank you.

Upvotes: 5

Views: 20295

Answers (3)

Sachin
Sachin

Reputation: 797

<div style='width: 240px; height:530px; overflow-y: auto;'>

<table>
bla.. bla..

</table>

</div>

We can use other option overflow: auto; if we want both scroll bar X And Y

Upvotes: 1

ShibinRagh
ShibinRagh

Reputation: 6656

<div style='width: 240px; min-height:530px; overflow:scroll;'>
<table>
bla.. bla..
</table>
</div>

Upvotes: 3

Mohanraj
Mohanraj

Reputation: 4210

You can use set min-height and max-height, so if it exceeds the max-height the scroll will be displayed

Upvotes: 2

Related Questions