Results 1 to 6 of 6

Thread: Div following another div's height?

  1. #1
    Join Date
    Dec 2008
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Div following another div's height?

    Well, I got a div named "div1" and an other below it with the name "div2".
    "div1" has the height "auto", so the height is following the text amount. But the problem here is that when "div1" changes height, "div2" is still at its default position, like an absolute position (which it isn't). So how to do so "div2" is following "div1"'s height?

  2. #2
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    It depends how the div containers are placed on the page so:
    Please post a link to the page on your site that contains the problematic script or attach your code so we can check it out.

  3. #3
    Join Date
    Dec 2008
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    well ok:
    http://heaven-rose.no-ip.org/heavenrose/index.php

    my computer may be turned off sometimes, so that could be a reason why the page doesn't work sometimes...

    the real ID's is not "div1" and "div2" now.
    In this page, I mean "loginBar" and "serverBar", and actually a 3rd bar called "screenshotsBar".

    So what you ca do is test to log in with random details (so you typing details that isn't in the database), so you'll get an error with red text.
    This red text should make the 2nd div ("statusBar") to be pulled down a bit.
    Last edited by bladefinor; 01-05-2009 at 01:33 PM.

  4. #4
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    That's because the first container has a fixed height. Remove the highlighted:
    Code:
    #loginBar {
    height:150px;
    left:auto;
    margin-left:1px;
    margin-top:1px;
    width:150px;
    }
    If you want some space after the container you can instead give it a bottom margin or some padding.

  5. #5
    Join Date
    Dec 2008
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Oh damnit, I just forgot to remove just "loginBar"'s height. Well you helped me anyway, thx!

  6. #6
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    You're welcome, glad to help!

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
  •