...

View Full Version : Resizing DIV based on PHP content



Owener94
12-21-2011, 03:48 PM
Hey guys :)

So basically I have an admin centre on my site I am trying to integrate.
Let's say I have a single DIV (with a border around it) with content in. Works perfect. However, on the admin centre page it doesn't work how I want it to. The amount of content varies as it is PHP-generated and displays new users all the time.

So the dilemma I am having is that the DIV just stays at a fixed height (of about 30px) and won't retain :auto; to wrap around all the content generated via this PHP code.
Is there a simple CSS way around this or is it perhaps something for Javascript? Or is it just an error...?

I appreciate any help, I've been looking but all of them are just relevant to iframes so I'm getting a little lost. :confused:

Cheers for reading anyway, hope someone can help! :)

Regards
Owen Ayres

resdog
12-21-2011, 04:11 PM
without seeing what your code and css is, it's hard to diagnose the problem. My first question to you is have you assigned a set height to the div? If so, remove that.

Secondly, is the Div floated? If so, add the property "overflow: hidden" to fix it.

Otherwise, I'd need to see your code to troubleshoot the error.

Excavator
12-21-2011, 04:12 PM
Good morning Owener94,
Without seeing your code I would guess that your bordered div has uncleared floats in it. See this explanation of how overflow: auto; clears your floats (http://www.quirksmode.org/css/clearing.html).


Your issue could also be caused if the content of your bordered div is posititioned.

Owener94
12-21-2011, 04:33 PM
without seeing what your code and css is, it's hard to diagnose the problem. My first question to you is have you assigned a set height to the div? If so, remove that.

Secondly, is the Div floated? If so, add the property "overflow: hidden" to fix it.

Otherwise, I'd need to see your code to troubleshoot the error.

Both solutions do the trick. Thank you for the quick reply. I knew more information may have been necessary but thought a simple solution such as this may have done the trick. I appreciate the help from both of you! :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum