Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Basically you need to give the footer a fixed <code>height</code> and to <em>push</em> the footer with another div of the same height to the bottom. There's however more browser specific stuff which you need to take into account:</p> <ol> <li>The <code>html</code> and <code>body</code> must besides having a height of 100% <strong>no</strong> (default) margin to avoid the footer being pushed further to below that amount of margin.</li> <li>The <code>p</code> and <code>div</code> elements throughout the page must have <strong>no</strong> <code>margin-top</code> to avoid the footer being pushed further to below that amount of top-margins in under each Firefox.</li> <li>The "container" <code>div</code> must use <strong><code>min-</code></strong><code>height</code> of <code>100%</code> instead of <code>height</code> to avoid the footer to overlap the remaining of the content. IE6 which doesn't know <code>min-height</code> just works fine with <code>height</code>, so you'll need to add a <code>* html</code> hack for this.</li> </ol> <p>All with all, here's an <a href="http://sscce.org" rel="nofollow noreferrer">SSCCE</a>, just copy'n'paste'n'run it:</p> <pre><code>&lt;!doctype html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"&gt; &lt;title&gt;SO question 1900813&lt;/title&gt; &lt;style&gt; html, body { margin: 0; height: 100%; } p, div { margin-top: 0; /* Fix margin collapsing behaviour in FF. Use padding-top if necessary. */ } #container { position: relative; min-height: 100%; } * html #container { height: 100%; /* This is actually "min-height" for IE6 and older. */ } #pushfooter { height: 50px; /* Must be the same as footer height. */ } #footer { position: absolute; bottom: 0; height: 50px; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="container"&gt; &lt;p&gt;Some content&lt;/p&gt; &lt;div id="pushfooter"&gt;&lt;/div&gt; &lt;div id="footer"&gt;Footer&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>Edit</strong>: after more testing I realized that this indeed does <strong>not</strong> work in IE8 (I still consider it as a beta so I didn't really use/test it, sorry about that), <em>unless</em> you let it render in IE7 compatibility modus (insert sad smilie here) by adding the following meta tag to the <code>&lt;head&gt;</code> (which I already added to the SSCCE here above):</p> <pre><code>&lt;meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"&gt; </code></pre> <p><em>or</em> to let it render in quirks mode by using a "wrong" doctype (either remove the <code>&lt;!doctype&gt;</code> or pick one of the doctypes associated with painfully red <code>Q</code> boxes in IE <a href="http://hsivonen.iki.fi/doctype/" rel="nofollow noreferrer">here</a>). But I wouldn't do that, that has more negative side-effects as well.</p> <p>And, surprisingly, the <a href="http://www.cssstickyfooter.com" rel="nofollow noreferrer">http://www.cssstickyfooter.com</a> site as someone else here mentioned here which used an entirely different approach also did <strong>not</strong> work in IE8 here (try to resize browser window in y-axis, the footer won't move along it as opposed to other browsers, including IE6/7). That browser keeps astonishing me. Really.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload