Forum Moderators: not2easy

Message Too Old, No Replies

Relative Positioned Container Div Not Expanding to Absolutely Position

         

g123s

11:03 pm on Apr 12, 2009 (gmt 0)

10+ Year Member



Hi,

I've positioned my container div relative. In the container, I then positioned my center content div absolute.

The problem: The container div is not expanding with the content div. You can see this because the content div is overlapping my footer which is clear: both.

You can check out my website: <snip>

Thanks

[edited by: swa66 at 11:38 pm (utc) on April 12, 2009]
[edit reason] No personal URLs please see ToS and Forum charter [/edit]

swa66

11:42 pm on Apr 12, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld! [webmasterworld.com]

clear is to clear a float, not an absolutely positioned element.

An absolutely positioned element is not influencing other content at all, so it will not influence the size of it's parent.

If you just want to center something there are alternatives to a relative positioned container with an absolutely positioned child.
The easiest solution is to set a width and give left and right margins he value "auto". Do take care not to have IE6 in quirks mode as it doesn't do it if you have it in quirks mode.