Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS Question -- Position absolute??

Status
Not open for further replies.

photoxprt1868

Programmer
Jul 22, 2005
76
US
Hello,

I have a couple of Server Side Includes that when combined together come to form a Left Menu with 4 different sections. Throughtout the site, all four sections might not be needed, so how can I code the CSS so that when section 3 is not used (not included), section 4 moves up to be just below section 2. Each section is inside a <DIV> tag. The first section, will always be there, but the other three might or might not. Right now I have position: absolute, and then top:whatever, left:whatever, but obviously if I don't use section 3 there's a hole beteen 2 and 4.

Thanks in advance
 
No need to position:absolute them. If you set their myDivId.style.display = 'none', then the space it would otherwise take up may be used by whatever is next.

To put any one back: myDivId.style.display = 'block'

Does that make sense?

'hope that helps.

--Dave
 
Absolute positioning is exactly what you want to avoid, because absolute positioning is taken out of the normal flow of the document and as such has no impact on other elements. If you only position your divs with margins and such, you should be perfectly ok.
 
It's hard to say without knowing more about your layout. I think I'd be inclined to use a single <div> to enclose your four included <div>s:
Code:
<div id="sidebar">
  <div id="part1">...</div>
  <div id="part2">...</div>
  <div id="part3">...maybe...</div>
  <div id="part4">...</div>
</div>
Then use the positioning method of your choice on [tt]div#sidebar[/tt] to get it where you want it. The four included <div>s will be placed using the regular document flow within the sidebar <div>, aided by margins and padding as required.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Thank you all for your responses.

My layout is a bunch of different SSIs that come to form one page. I have one global menu at the top with a search box, and some other global links, and a Logo. Then I have a left menu that is formed of 3 seperate SSIs itself, and then I have a right section that is basically the same as the left one, and then I have a footer with some copy right crap. How can I keep all this mess in place without absolute positioning. Thanks for all your help
 
by the way each SSI is a div tag...I don't know if this helps or not.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top