My Footer Floats

jivers picture jivers · Nov 20, 2013 · Viewed 7.4k times · Source

I have been trying various "sticky" footer solutions for the better part of three days with no success. I seek to place the footer at the bottom of the browser window in instances when not enough content is present to span the window's full height. Please. Help.

Here's the basic site structure:

<div id="siteWrapper">
     <header>
         <div id="header">
             <div id="headerWrapper"></div>
         </div>
     </header>

     <div id="content">
          <div id="innerWrapper">
               <div id="columnLeft"></div>

               <aside>
                    <div id="aside">
                         <div id="asideWrapper"></div>
                    </div>
               </aside>

          </div>
     </div>

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

</div>

And the associated CSS, edited for brevity, and also not reflecting any of the solutions I've tried (see below):

* {
     margin: 0;
     padding: 0;
     }

#header {
     width: 100%;
     display:inline-block;
     }

#headerWrapper {
     width: 90%;
     max-width:980px;
    }

#sitewrapper {
     width: 100%;
     min-height: 100%;
    }

#content {
     padding: 2%;
     width:90%;
     max-width: 980px;   
    }

#innerWrapper {
     display:inline-block;
    }

#columnLeft {
     display: inline-block;
     width: 70%;
     float: left;
     }

#aside {    
     width: 30%;
     float: right;
     }

#footer {
     background-color: #f5f5f5;
     width: 100%;
     }

I have tried the following solutions (I can only list two, evidently, because I lack reputation points), including Ryan Fait's...:

http://www.cssstickyfooter.com/
http://css-tricks.com/snippets/css/sticky-footer/

I'm not a developer, just someone who uses Google. This is the first "responsive" site I've developed, and the first time using HTML5 / CSS3.

One thing I've observed is people (Ryan Fait included) applying styles to what I understand to be HTML5's semantic elements (<header>, <article>, <aside>, <footer>). Is this common practice? If so, I can reduce the number of structural div's I'm using, which would nice.

Also, I have tried closing the siteWrapper div both above and below the footer, adhering the varying methods demonstrated in each solution listed above. I have viewed these various solutions in Chrome, Firefox, and Safari.

Any help you can provide is greatly appreciated.

Answer

Charlie Affumigato picture Charlie Affumigato · Nov 20, 2013

you could try positioning the element as { /other css attribs you want to set...;/ position: absolute; bottom:0; width:100%; height: 20px;} or whatever height you want. This will give you an always on footer. Hope it helps.