Reputation: 95
I'm trying to figure out a good/best implementation to create a kind of dynamic scrollable div/area.
A an example, I can create the following:
<div id="batchList" name="batchList" style="height:200px;overflow: auto;" >
.blah
.blah
.blah
</div>
The above presents a 200px vertical space... which is ok if the inner content is more than the 200px, as it the area then has the vertical scrollbar.
However, if I want to have a shorter vertical space which only has a few lines of inner content, how is this accomplished? in other works, is there a way to have a kind of dynamic vertical space, up to a max vertical space, which then starts to be scrollable?
Upvotes: 2
Views: 2501
Reputation: 501
If I understand correctly then I think that's what you need.
Just change height:200px
to max-height:200px
Upvotes: 0
Reputation: 303168
Use CSS max-height
:
#batchList { max-height:200px; overflow:auto }
(Also, don't mix your CSS style with content markup.)
Upvotes: 1