Say I have the following "template" for what one of my pages should look like:
My pages consist of a header, a content section (different for each page), and a footer. Page height is the header height + content height + footer height. Notice the height of the footer; it's pretty tall/beefy. I'm OK with this.
I don't want a 'sticky' footer, instead I'm looking for the following functionality:
- If the header height + content height is greater than viewport/window height, I don't want the footer to be visible until the user scrolls down to it (normal footer behavior); but...
- If header height + content height + footer height is less than viewport/window height, I want the footer pinned down to the bottom of the viewport. Meaning if the content for a particular page is very small or is even coompletely empty, I want my header pinned to the top of the window, and the footer pinned to the bottom.
Example in jsFiddle
What do I need to do to change my footer
div to exhibit the desired behavior?
<!-- What needs to change here? -->
<div class="footer ">
This should always be shown at the bottom if there isn't a lot of content to display below the header.
</div>