Jump to content

position:absolute;


gd4

Recommended Posts

I am building a page that has a large box with two boxes inside.The two sub boxes are to be side by side.This is how I'm handling it:<div style="position:relative; border:1px solid #000000;"> <div style="position:relative; top:5px; left:5px; width:100px; border:1 px solid #000000;"> some content </div> <div style="position:absolute; top:5px; left:105px; border:1px solid #000000;"> some more content </div></div>This works fine until the content of the second (right-most) box gets too big. Then the right-most box grows vertically and extends past to border of the outer-most box.If the left-most (relatively positioned) box grows vertically, the outer box grows correctly.Is there a way to make the outer-most box grow as the inner "absolutely positioned" box grows?

Link to comment
Share on other sites

not if it is absolutely postioned. When using absolute positioning it is like you are placing hte box in another 'layer'. The box is just sitting over top of the other boxes.the only way to acheive what you what is to change this box to relative like the rest...it should be possible.

Link to comment
Share on other sites

I'm not sure how to do it using relative only.The content of each box is variable, so I won't know ahead of time how high each will be.Therefore, I won't know how to position the rightmost box relative to it's normal position, because I don't know what it's normal position is.The height of the leftmost box will dictate the normal position of the rightmost box. I want the tops of the two boxes to line up, but I won't know what value to use in the "top:?px" style.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...