Forum Moderators: not2easy

Message Too Old, No Replies

How can I position a <div> below another div?

2 <divs> are separated by text, but I <div2> to be directly below <div1>

         

knnknn

5:45 pm on Aug 17, 2004 (gmt 0)

10+ Year Member



I have following layout:
<div1>
Some text
<div2>

I want to display <div2> directly BELOW <div1>.

Do I need to know the top position and the height of <div1>?

knnknn

5:54 pm on Aug 17, 2004 (gmt 0)

10+ Year Member



A similar problem is to align 2 divs, so that the border of <div2> is where the right border of div1 is:


<..............div 1>
...............<div2>

chal990

4:29 pm on Aug 18, 2004 (gmt 0)

10+ Year Member



okay i'm new to this forum kinda thing, but i hope to be of some help.
you have two div tables separated by text, u want i assume to have them "touching"
<div id="topdiv">lorum ipsum dolor, my content here</div><div id="bottomdiv">MY BOTTOM content here</div>

and in the css file
#topdiv {
margin-bottom:0px;
}
#bottomdiv {
margin-top:0px;
}

that should generally result in the two div tables touching, one directly below the other. there may be issues with height and width, which can be fixed using the height:; and width:; attributes in the css.
hope i was some help, tell me if not!
James

chal990

9:16 am on Aug 19, 2004 (gmt 0)

10+ Year Member



Okay, you also want to line up the borders of two div's,
<div id="one"></div>
<div id="two"></div>

simply put this can be controlled effectively either by using position:absolute; or setting margins.

in the css,
#one {
margin-left:20px;
}
#two {
margin-left:20px;
}

that should line them up,
also,
#one {
position:absolute;
left:20px;
}

#two {
position absolute;
left:20px;
}

hope that helps