• We should now be fully online following an overnight outage. Apologies for any inconvenience, we do not expect there to be any further issues.

Scrollable DIV

mugs

Lifer
Apr 29, 2003
48,920
46
91
I have a portion of my page that I want to scroll if the height is greater than 200px. I accomplished that by using this tag:
<div style="overflow: auto; width: 558px; height: 200px; padding:0px; margin: 0px" align="left">

The problem is, the div tag will take up 200px even if there is only one line of text in it. What I want it to do is take up as much space as it needs to UP TO 200px, and beyond that it will be 200px high and scrollable.

The HTML inside the div tag is database driven, and there is no way for me to tell programmatically how much space it will take up.

Anyone know how to code that?
 

mugs

Lifer
Apr 29, 2003
48,920
46
91
Originally posted by: Modeps
mugs, you're insane! INSANE!

Bit early to be drunk, eh? :p

max-height didn't work screw3d. I don't know about you two, but my avatar's gender is not the same as my own. :)
 

screw3d

Diamond Member
Nov 6, 2001
6,906
1
76
Have you tested this on both IE and Firefox?

Edit: OK I've tested it.. works for me :confused:

Edit2: NVM.. works on Firefox but not on IE. IE blows but you'll have to support it anyway :frown:

Edit3: OK found a solution. Use max-height, but you will have to insert a Javascript from here to make it work with IE.
 

mugs

Lifer
Apr 29, 2003
48,920
46
91
Thanks screw3d, I got an answer from Experts-Exchange that was essentially the same as the javascript suggestion.