Forum Moderators: not2easy

Message Too Old, No Replies

absolute and relative - neither work

covering text on a page

         

soapystar

3:44 pm on Jun 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Heres the setup....a page is 800 px wide and is centered...this means the left margin is right next to the left hand side of the browser window up to 800px...after that as you open the browser window larger the left hand margin will move towards the centre of the page..this means i cant predict the exact position of the left text relative to the window....

the problem is i cant control the auto generated code and i want to cover the left hand margin with a coloured div so as to create my own left hand margin over the auto generated one...i am able to add my own code to the generated page but cant change the code generated before that stage..

i dont see how to position a div element so it is in the same position as the current margin...if i make it relative it will just push down or up all the other code..if i make it absolute then it will only work at one screen size...

sifredi

6:17 pm on Jun 16, 2007 (gmt 0)

10+ Year Member



I guess you are looking for a way to add a division width that equals something like (window_width-800px)/2. SOunds like javascript to me, unless the content div has a percent width; if the #wrapper was 80% wide, the remaining margin on each side would be (100%-80%)/2 = 10%.

If you want to position something absolute inside another div that is centered, try adding position: relative; to the parent division before doing absolute positioning inside it. But that's probably not an answer to your question...

Xapti

3:27 am on Jun 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



you worded what you wanted in a really strange and difficult to understand way.
Now that I think I've figured out what you want, I can say that it cannot be done with CSS.
I would perhaps recommend redesigning your page instead of moving to something like javascript.
Why do you need stretchy divs to go over the variable margins of the content area? I don't really see what could be put in there of meaning... if the user's window is 800px wide or less the side content would not even be viewable, and if the window is very large, it would also look strange, because either the text or image(s) would have a large gap, or the image/content would be stretched too wide.
I don't see the use of what you're trying to achieve.

soapystar

5:37 pm on Jun 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



thanks guys. In the end i managed to find a work around.