Forum Moderators: not2easy

Message Too Old, No Replies

query regarding positioning

using multiple types of positioning on a single page

         

naiquevin

9:50 am on Apr 27, 2009 (gmt 0)

10+ Year Member



Hi,
I am working on a page where users post comments ..
The HTML table that carries the comments has been positioned using absolute property(or whatever its called!) in CSS

although pagination is used to show 10 comments per page, the height of the table varies depending upon the quantity of text in each comment.

Now I want to position a footer just below the comments section... so that wherever the comments section ends, the footer starts
But I am unable to figure out a way to position something absolutely(comments table in this case) and then some thing else(footer) relative to the first

I tried using position:relative; but it doesnt work

Any solutions ?
Thanks

PS> The footer is a seperate .php file that will be included in the main page

swa66

7:04 pm on Apr 27, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Since you don't know the height of the absolutely positioned element, putting something underneath it is very hard as there's no easy (even one at all?) way to position something relative to the position of an absolutely positioned element.

naiquevin

4:12 am on Apr 28, 2009 (gmt 0)

10+ Year Member



oh! .. so what can be done ?
is duplicating code in all the .php files a good idea ?

swa66

8:51 am on Apr 28, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The problem isn't in how you generate the html (via php or not). It doesn't even matter as the browser will only see the html, not the php.

The problem is how you position it via the CSS. Absolute positioning means it is extremely hard to position anything under it if you don't know the height the absolutely positioned block will turn out to be.

Try not using absolute positioning and it'll work.

naiquevin

1:21 pm on Apr 28, 2009 (gmt 0)

10+ Year Member



Finally got it!
I tried putting the whole thing in a table with the footer in the last row and then I positioned the table using CSS
This works beautifully..