Click to See Complete Forum and Search --> : Reading Div Heights


Sup3rkirby
09-11-2005, 11:08 AM
I'm not quite sure how to put this. I have a div that is set at 175 pixels high. I have a div inside of that. In this div, I did not set a height. This is because the content inside of it may vary, so the size may need to change(letting it automatically size itself(but only with the height)).

Now, if I try to read the div height of the auto-sized div, it is undefined.

Is there anyway to get the height of that div so that it can still size it self(if needed) and have a readable height(Object.style.height)?

felgall
09-11-2005, 03:33 PM
Have you tried defining overflow for each of the divs. Most browsers ignore heights on inline and block elements unless overflow is defined so that the browser knows what to do if the content doesn't fit.

Sup3rkirby
09-11-2005, 03:47 PM
Well, I'm not quite sure what to do then. I have one div with an overflow of hidden, so it will not change it's size or show a scrollbar.

My other div, inside of the other, does not have an overflow set. I want it to auto size itself. It has a set width, but not height. I want that div to get as big as it needs to, but if I don't set the height, it can't be read. it either shows up as "" or "undefined".

So if overflow is the answer, then what overflow would I use for the inside div?(I dont' want it to scroll).