Forum Moderators: not2easy

Message Too Old, No Replies

Absolute vs relative positioning.. Need help

         

plasma800

7:44 pm on May 19, 2005 (gmt 0)

10+ Year Member



My site used a 770px browser centered design.

Here's what I wanted to do.

I wanted to use CSS positioning to put a paragraph or two as the first bit of text IN THE CODE, but have it positioned else where on the page.

So inside by body tag, I put a div and tried to postion it relative. The text did move DOWN the page, but it left a gap at the top.

So I tried absolute and the gap went away, however in this case, I cannot seem to control it's position left to right.

Maybe I should use a container div... set to 770px wide, use margin for the left right and absolute for the top down?

Stormfx

6:40 am on May 22, 2005 (gmt 0)

10+ Year Member



Actually, if you're using the position:relative correctly, it shouldn't leave a gap. Unless there's other content that's in the way. Make two divs, one for the text you want moved, one for the rest. Set the relative position of the paragraph you want moved, then set the relative position of the rest of the text to the top. Or, in otherwords, at 0.

#moved {
position: relative;
top: <whereever you want it>;
}

#therest {
position: relative;
top: 0px;
}