CSS question.

Associate
Joined
5 Jan 2005
Posts
2,236
Location
Cyprus
I am making a website for a mate and i inserted a vertical menu in that div layer. The height value for the menu div is set to auto. Now since the navigation is loaded in the div layer using php and i can't use a certain value in height, is there is a way to make a div layer below the navigation to move according to the height of the div layer above it?!
 
Are the div's floated at all?

float:left;

+1

The other slightly deprecated way of doing it, but which is still useful sometimes, is use a <BR CLEAR=ALL> tag under the topmost element to force everything after it to be on a new line. It's an ugly way to fix it though.
 
Here is an example of what i want to do.

#menu_placeholder {
position: absolute;
top:260px;
right:74%;
width:180px;
height: auto;
overflow: hidden;
}
#random_placeholder {
position: absolute;
top: auto;
right: 74%;
width:180px;
height:30px;
overflow:hidden;
}

How can i make the div called #random_placeholder to get further down when the above div layer #menu_placeholder expand?
As i have said these two are placed below each other on the same x cordinate which is % based in this case.
 
Its a lot easier if you post a link to the site however:

#menu_placeholder {
position: relative;
float: left;
top:260px;
right:74%;
width:180px;
height: auto;
overflow: hidden;
}
#random_placeholder {
position: relative;
float: left;
top: auto;
right: 74%;
width:180px;
height:30px;
overflow:hidden;
}

Will probably give you a start. I figure you're going to have to play with your top positions after I do that.

I tend not to specify a height for my divs unless I need to. I let the content stretch it as is needed and use padding to make sure there is enough space.
 
Last edited:
Generally, if you can avoid using absolute positioning, avoid it. It'll just come back to bite you later on when you want to modify the layout.
 
Thanks for the help guys. This can't be the case since i shall crush my friend like a worm if he wants to change something! :p
 
Back
Top Bottom