Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Aug 2009
    Location
    public_html/cgi-bin/
    Posts
    91
    Thanks
    14
    Thanked 1 Time in 1 Post

    Question Resizing DIV based on PHP content

    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.

    Cheers for reading anyway, hope someone can help!

    Regards
    Owen Ayres

  • #2
    Regular Coder
    Join Date
    Aug 2011
    Location
    U.S.A.
    Posts
    233
    Thanks
    2
    Thanked 48 Times in 48 Posts
    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.
    WordPress Designer and theme developer. KlongDesigns - helping bloggers and non-technical folks claim their space on the internet.

  • #3
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,749
    Thanks
    22
    Thanked 1,838 Times in 1,822 Posts
    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.


    Your issue could also be caused if the content of your bordered div is posititioned.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #4
    New Coder
    Join Date
    Aug 2009
    Location
    public_html/cgi-bin/
    Posts
    91
    Thanks
    14
    Thanked 1 Time in 1 Post
    Quote Originally Posted by resdog View Post
    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!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •