Make a Footer Stick at the Bottom of the Page

For a long time I’ve been looking for a simple solution to make a footer stick to the bottom of the page until I came across this solution. Best of all is that it works with the major browsers: Internet Explorer 5 and up, Firefox, Safari, Opera.

This is how you do it

Add the following lines of CSS to your stylesheet. The negative value for the margin in .wrapper is the same number as the height of .footer and .push. The negative margin should always equal to the full height of the footer (including any padding or borders you may add).

* {
margin: 0;
html, body {
height: 100%;
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -4em;
.footer, .push {
height: 4em;

Follow this HTML structure. No content can be outside of the .wrapper and .footer div tags unless it is absolutely positioned with CSS.

        <link rel="stylesheet" href="layout.css" ... />
        <div class="wrapper">
            <p>Your website content here.</p>
            <div class="push"></div>
        <div class="footer">
            <p>Copyright (c) 2008</p>

Source: ryanfait..


Esau Silva
Software Engineer at Region One ESC
Full Stack Software Engineer working with Microsoft technologies, ReactJS is awesome and avid Brazilian Jiu-Jitsu practitioner
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed.