Making div to drop down when div beneath it change it's height dimension ?

Discussion in 'CSS' started by Error404, Oct 15, 2007.

  1. #1
    OK,I will try to be as clear as possible.
    I have one div (container) 500pix height containing two another divs in it. One of them is 200 height and another one that is on bottom is 300. Now if I manually change dimension of div that is on bottom to 200 pix, I want the one that is on top to get down as much as it can (so it's 100pix in this case) to the top of the one div that is on the bottom.
    So if you understand me I want to make the position of the div that is on the top to depends on the height dimension of the div that is on the bottom, and to always drop down to it so they touch each other.
    I need this for some javascript programming...
    Thanks
     
    Error404, Oct 15, 2007 IP
  2. NineDesign

    NineDesign Peon

    Messages:
    237
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Couldn't you just remove the 500px height of your container DIV?
     
    NineDesign, Oct 15, 2007 IP
  3. grikis

    grikis Banned

    Messages:
    333
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    use css - position,overflow functions
     
    grikis, Oct 15, 2007 IP
  4. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Me need pictures. But I think you mean the divs are growing upwards instead of downwards like normal?
     
    Stomme poes, Oct 15, 2007 IP
  5. Error404

    Error404 Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    OK I put picture as an example of what I need to do. I think everything is clear for understanding if you look at it. My problem is to make div1 follow div2 as in the picture.
    Thanks
     

    Attached Files:

    Error404, Oct 15, 2007 IP
  6. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Hmmm... methinks you'd need Js to first shrink div2, and then add the exact amount subtracted from div2 and add that as maybe top margin for div 1.

    I say this because generally, a webpage and css use the top and left sides for reference most of the time. Simply saying there can be no increasing of space between the two divs wouldn't be enough to drop the div1 down, because it's not actually sitting on div2. Instead, div1 is hanging from it's top and left sides (assuming no absolute positioning or floats), so whatever happens below it, it will generally ignore.

    I'm not 100% sure on this, as I'm not yet a Crusty Old Guy Who Knows Stuff.
     
    Stomme poes, Oct 17, 2007 IP