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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Relative div overlaps following divs 1

Status
Not open for further replies.

dalchri

Programmer
Apr 19, 2002
608
0
0
US
Hello,

I've got the following:

Code:
<div id="div1" style="position:relative;"><!-- Map inside here with a few controls docked to the upper left, lower left, and upper right --></div>
<div id="div2"><!-- More content --></div>

As soon as I set div1 to relative positioning, div2 slips up to the top of and underneath div1. I was expecting div2 to remain below div1.

What did I do wrong?
 
You are not giving us enough information. If div1 is relative, then div2 will follow it in the flow.

If, however, all of div1's contents are absolutely positioned within it, they are removed from the flow and div1 essentially has no content and div2 flows up to fill its space (or all of the space that is not positioned absolutely).

If that is what you are encountering, you may need to define a height for div1 so the browser knows how much space to reserve for it in the flow.

Greg
People demand freedom of speech as a compensation for the freedom of thought which they seldom use. Kierkegaard
 
That was it. I was expecting the absolutely positioned contents of div1 to increase its size. As soon as I sized it, everything was working as expected.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top