SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    make a DIV grow with content (was "Stupid question")

    Cant figure out how to make a div grow with content. I have the content where I want it, looks great, but after you submit a form and the page reloads, theres more information printed, and so a lot of the text overflows.

    I'd rather not do a scroll, i have that on there now to fix the problem, but it looks bad.

    How do I make it so when more information is put in the div, the div will grow in height to accomadate that change?

    Thanks

  2. #2
    SitePoint Addict
    Join Date
    Nov 2004
    Location
    London
    Posts
    248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The default behaviour of a DIV is to grow with content. Have you set its height?

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well yes, and I see that if I take the height out, then it grows with content. But say I have a div inside a div, and I want the outer div to grow when the inner one grows...

    I tried taking the height out of the outer div, but then the div was just the minimum height (like a pixel) instead of containing everything.

  4. #4
    [Biped] LJK's Avatar
    Join Date
    Jun 2004
    Location
    In My Jammies
    Posts
    761
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi -
    If you post your code, bet we could help sort things out -
    uness you've figured it already ;-)

    El
    F-Fox 2.0 :: WIN :: el design :: US

  5. #5
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're either using absolute positioning, which you would need to remove, or you need to clear the floated elements.

    I suggest you learn more about CSS Layout Techniques.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  6. #6
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Clearing float elements helped sorta. For example:

    This page looks fine: Index

    And this page, the rightside grows with content 'to a point', but still gets cut off. I have no idea why.

    searched

    And please dont worry about valid code or IE bugs. It will come in time.

    But any help with the divs/content growth is appreciated.

  7. #7
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's getting cut off because of your use of relative positioning. I suggest you read the articles listed under it on the page I linked to.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.


Bookmarks

Posting Permissions

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