views:

154

answers:

3

Again me with my divs =(. I have this:

<div id="header"></div>
<div id="body">
  <div id="..."></div>
  <div id="..."></div>

  <div id="content"></div>
</div>
<div id="footer"></div>

and css:

#body { width: 100%; margin 0 auto; }
#content {   position: absolute;   height: 200px; width: 100%; }
#footer {   height: 63px;   clear:both; }

Now result: content div with much text and footer under text.

How can I make my footer under all content-area?

+1  A: 

Note, there is a stackoverflow-like site for designers called doctype: http://doctype.com/

Andrew Sledge
Thanks, I didn't know about that.
Ockonal
It's cool. Most people don't know that.
Andrew Sledge
Somebody flagged this for promoting a competing site, so I just want to add that doctype.com is affiliated with SO through the League of Justice program. http://blog.stackoverflow.com/2009/08/stack-overflow-and-doctype I just want everyone to know that it's okay to promote doctype, and there's even a link in the footer of SO and all sister sites.
Bill the Lizard
I didn't flag this (I'm aware of the affiliation) but I don't see the point of sending people to doctype - this is a perfectly legitimate programming question, it's fine on SO.
DisgruntledGoat
@DisgruntledGoat: I agree, this is a perfectly valid question for SO. My only concern was that someone thought this answer was out of line for promoting doctype. Some questions are just going to naturally be at home on either site.
Bill the Lizard
A: 

I've encountered this situation several times. I've been using sticky footers. It's widely compatible with several browsers and just seems to work.

pixelbobby
A: 

If you use this styling you will see the (blue) #footer under the (red) #content as you requested:

#body {width: 600px; margin 0 auto; }
#content {position: relative; height: 200px; width: 600px; background-color: red; }
#footer {height: 63px; clear:both; width: 600px; background-color: blue; }
Kim Andersen
It does'nt help :(
Ockonal
Just modified the answer. This one is tested and works :)
Kim Andersen
It really doesn't work for me.
Ockonal
Ahh sorry. It was a typo. The position on #content should not be absolute, but relative.
Kim Andersen
My content-div should be over another divs from body. So I can't change it position to relative.
Ockonal
Hmm... The #content is under the #body. This means that the content-div is placed inside of the body-div, right?So the body-div is actually just seen as a "container" containing the content-div and others if you like this.So the content-div can be placed on top of the body-div if you like that.
Kim Andersen