views:

118

answers:

3

Ok, this is really annoying and I can't understand why this is even happening. I may have screwed some stuff up when trying to get the CSS Sticky footer to work.

I had one going on, but it seemed at the body wasn't liquid so I thought I'd try this one: http://ryanfait.com/sticky-footer/

But the results ended up like this: http://www.serverbart.com/film/

The blue box is supposed to resemble a gallery, so nevermind the color :p I guess you'll understand what I'm trying to do, and I'm open for input about redesigning the div structure! I'm trying to get really good at different layouts and this one has been bugging me a bit.

+3  A: 

You are not following Ryan Fait's example. For starters, the push goes inside wrapper.

NickLarsen
But it is inside the wrapper. That's what I find so strange. It appears as though it's outside, but it's really inside.If you use FireBug and mark the mainwrapper div, it seems as though the height is set statically, but it's really 100%, so it should really select the entire content, including the footer AND push.
Kenny Bones
Also, try selecting the Gallery div. Notice how the selection partially seem to move onto the footer? Like the height is specified or something?
Kenny Bones
It doesn't matter what it looks like in firebug, when I clicked view source, the push div in your source is outside the wrapper. Remove all the extra stuff and start fresh without copying and pasting and you will probably solve your problem in 10 minutes.
NickLarsen
My answer below solves the entire problem. He has 1 outermost div when he needs 2. the first one contains everything except the footer and then there's the footer div. Trust me i had this problem for like 2 straight weeks before i figured it out.
Catfish
A: 

The height for the push and the footer must be the same. The push must go inside the wrapper.

Davey
And it is the same. The push is also inside the wrapper.
Kenny Bones
A: 

It's because you have this:

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

It took me forever to figure out what i was doing wrong the first time i created a sticky footer as well and it has to be like this

<div id="mainWrapper">
    <div id="content"></div>
    <div id="push"></div>
</div>

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

You have to explicitly have 2 divs as your outermost divs, not just one main wrapper.

Catfish
Not sure what you mean here, where does the mainWrapper in this case go? You're talking about adding another wrapper outside of the mainWrapper in this case?Edit: Btw, I just tried to add en empty div outside the mainWrapper without connecting it to an id or class. And weird stuff happened. So I tried applying 100% height and width and it ended up looking exactly the same as before.
Kenny Bones
Open up your webpage in firebug and look at the html. You have 1 outermost div with the id of mainWrapper. You have to have 2 outermost divs. Looking at your source code in google chrome your div tags are very hard to read. I don't think they match up like you think they are.
Catfish
Wait, so you're saying you need two outer wrappers? So I need to put mainWrapper inside a div? Should the footer be included in that div as well?
Kenny Bones
The example from Ryan doesn't have two wrappers. Either way, I have to think of another structure of the DIVs anyway. Because the div "gallery" needs to have 100% height and for that to work, the parent div needs to have a set height. And the parent div the wrapper. Which is set to 100%. Resulting in the gallery div to be set to height:auto.
Kenny Bones
I've updated my answer. Look closely at the div structure and the id's.
Catfish
#footer needs to be at the same level as #mainWrapper--not inside of it.
Catfish
I really get nothing now, you updated your example. And there aren't two wrapper divs there. It's exactly like my structure, except for the footer being outside of the wrapper.
Kenny Bones
That's the problem! the footer needs to be outside of the wrapper!!
Catfish
Start with a fresh .html file and try to just get a sticky footer before you do anything else. It will all become apparent to you then.
Catfish