View Full Version : position:absolute; problems


lukejtharries
04-15-2006, 09:35 PM
when I am aligning my footer div in my css, I put:
footer
{position:absolute;
left:10px;
bottom:0;
width:600px;
height:20px;
}
Now I don't know what I'm doing wrong, but when I do:
bottom:0;
it comes up at the bottom of the 'top fold' (the bit you see before scrolling down)
Does any one know what is wrong???

luvhartz
04-16-2006, 11:39 AM
try:

footer
{ position:absolute;
left:10px;
bottom:0px;
width:600px;
height:20px;
}

J to the izzosh
04-17-2006, 02:40 AM
try:

footer
{ position:absolute;
left:10px;
bottom:0px;
width:600px;
height:20px;
}
Actually, null (zero) values don't require a unit, so that wouldn't be the problem. 0 and 0px will give you the same result, as will 0em, 0%, 0pt, etc...

By your description, it sounds like the absolute positioning is working exactly the way it is supposed to. The left, right, top and bottom values are measured from the edge of the visible portion of your window, not from the edges of your document. Bottom, will position an element from the bottom of the window pane, not your document since the browser can't tell how high - or necessarily, where - your document is. So, if your document goes past the bottom of the window pane, then it will go past the bottom of an element absolutely positioned from the "bottom". You can get around it by not positioning your footer absolutely, and allowing it to flow along with the bottom of your document. Without actually seeing your site, of course, we have no way of knowing if this is the behaviour that you're actually talking about.

bejayel
04-17-2006, 11:40 AM
i am pretty sure that if relative positioin is used on te footer, then anything else that is positioned absolutely will simply overlap the footer (depending on teh z-index). in other words, the footer will not see that anything else is actually on teh page if your main content in positioned absolutly.

It is in my educated opinion tat you dont use absolute positioning anyway. You can get the exact same desired results by simply nesting divs, or tables. (dont just lay stuff out as my resolution might make things appear wrong).

J to the izzosh
04-18-2006, 07:17 PM
That is why you wouldn't position the footer relatively. You would just place it at the bottom whatever content container is absolutely positioned, and allow that content to push it down normally.

And there's nothing wrong with using absolute positioning. Like so many things, it's not the technique itself that makes or breaks a design, but how it is implemented. This, for example, is positioned entirely with absolute positioning in CSS: http://jfweb.fastmail.fm/center/center.htm. It will display just fine at any resolution not smaller than the box itself (normally positioned liquid layouts are victims of the same thing), and works fine in all major browsers.