Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show scroll after certain height but height should not be fixed?

Tags:

I have a div with following style: height:250px;scroll:auto;. I want it to scroll after 250 px but should have height according to the content in it.

For example, if the content in it is 100px, then, the height of div should be 100 without scroll. But, if the height exceeds 250px, it should show scroll.

How can do it?

like image 262
Salman Virk Avatar asked Feb 17 '11 22:02

Salman Virk


1 Answers

Is this what you are after?

Demo

CSS:

.dyn-height {     width:100px;     max-height:250px;     overflow-y:scroll; }

height: optional - just for the demo.

like image 73
Myles Gray Avatar answered Jan 31 '23 05:01

Myles Gray