Forum Moderators: not2easy

Message Too Old, No Replies

Positioning relative to the origin of a div

Is it possible?

         

kaled

11:30 am on Dec 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I updated my site this week making use of position:absolute, however, this causes elements to be located relative to the origin of the page. If I have elements within a div, I want to position them relative to the origin of the div.

Right now, the only problem I have is when pages are viewed within a search engine cache, but I would still like a solution.

Kaled.

Robin_reala

11:44 am on Dec 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you position an object absolute it will position according to the nearest positioned parent. Positioned in this case means having a position value that isn't 'static', so your choices are 'absolute', 'relative', or 'fixed'. Seeing as giving an element relative positioning on it's own doesn't change the location, the simplest fix for you is to give the parent element of your absolute elements 'position: relative;'.