Forum Moderators: not2easy

Message Too Old, No Replies

Changing where to absolute position starts from

Trying to position an element with a semi-liquid layout

         

Jeremy_H

10:32 pm on Sep 1, 2006 (gmt 0)

10+ Year Member



Hello,

My page's body has a set width, and a left & right margin set to "auto".

This centers my content in the middle of the page.

My problem is now I'm trying to absolutly position an element. I can position the elment vertically just fine, but problems arise when I try to set a horizontal position.

I notice that regardless of how big or small the user's window is (which will change the horizontal position of my page), the absolute starts from the top left of the window.

Is it possible to change this start position to begin from the start of the body, and not the window?

Maybe there's a better solution?

Thanks for your advice.

Robin_reala

11:20 pm on Sep 1, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A position:absolute element will position with regard to the root element eventually, but will first check to see if any ancestor is positioned and derive co-ordinates from them. 'Positioned' here means a position value of relative or absolute. So your fix is easy - give the container you want to position with regards to position:relative.

Jeremy_H

1:42 am on Sep 2, 2006 (gmt 0)

10+ Year Member



Thanks so much!

Appling position:relative to my body style made it work.

I was way off when I was trying to place style to my html style.

Thanks again.